lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

commit 62671cb7652b265892429899c2e6fce53c1dc6e1
parent 3de6577986d6fb00da1530be9923765897b34807
Author: triesap <tyson@radroots.org>
Date:   Sat, 27 Jun 2026 08:19:27 +0000

events: derive dto events listing products and bins

Diffstat:
Mcrates/events/src/dto.rs | 196+------------------------------------------------------------------------------
Mcrates/events/src/listing.rs | 8++++++++
2 files changed, 10 insertions(+), 194 deletions(-)

diff --git a/crates/events/src/dto.rs b/crates/events/src/dto.rs @@ -26,8 +26,8 @@ use crate::{ list_set::RadrootsListSet, listing::{ RadrootsListing, RadrootsListingAvailability, RadrootsListingBin, - RadrootsListingDeliveryMethod, RadrootsListingImage, RadrootsListingImageSize, - RadrootsListingProduct, RadrootsListingPublicLocation, RadrootsListingStatus, + RadrootsListingDeliveryMethod, RadrootsListingImage, RadrootsListingProduct, + RadrootsListingPublicLocation, RadrootsListingStatus, }, message::{RadrootsMessage, RadrootsMessageRecipient}, message_file::{RadrootsMessageFile, RadrootsMessageFileDimensions}, @@ -175,198 +175,6 @@ pub struct RadrootsOrderStatusDto; pub struct RadrootsOrderQuestionDto; pub struct RadrootsCommercialTransportLaneDto; -impl Dto for RadrootsListingProduct { - fn describe(ctx: &mut DescribeCtx) -> TypeRef { - let def = StructDef::new( - "RadrootsListingProduct", - "RadrootsListingProduct", - span("crates/events/src/listing.rs", 81), - ) - .with_field(field( - "key", - "key", - String::describe(ctx), - "crates/events/src/listing.rs", - 82, - )) - .with_field(field( - "title", - "title", - String::describe(ctx), - "crates/events/src/listing.rs", - 83, - )) - .with_field(field( - "category", - "category", - String::describe(ctx), - "crates/events/src/listing.rs", - 84, - )) - .with_field(optional_nullable_field( - "summary", - "summary", - <Option<String> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 85, - )) - .with_field(optional_nullable_field( - "process", - "process", - <Option<String> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 86, - )) - .with_field(optional_nullable_field( - "lot", - "lot", - <Option<String> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 87, - )) - .with_field(optional_nullable_field( - "location", - "location", - <Option<String> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 88, - )) - .with_field(optional_nullable_field( - "profile", - "profile", - <Option<String> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 89, - )) - .with_field(optional_nullable_field( - "year", - "year", - <Option<String> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 90, - )); - register(ctx, "RadrootsListingProduct", TypeDef::Struct(def)) - } -} - -impl Dto for RadrootsListingBin { - fn describe(ctx: &mut DescribeCtx) -> TypeRef { - let def = StructDef::new( - "RadrootsListingBin", - "RadrootsListingBin", - span("crates/events/src/listing.rs", 101), - ) - .with_field(field( - "bin_id", - "bin_id", - RadrootsInventoryBinId::describe(ctx), - "crates/events/src/listing.rs", - 102, - )) - .with_field(field( - "quantity", - "quantity", - radroots_core::RadrootsCoreQuantity::describe(ctx), - "crates/events/src/listing.rs", - 103, - )) - .with_field(field( - "price_per_canonical_unit", - "price_per_canonical_unit", - radroots_core::RadrootsCoreQuantityPrice::describe(ctx), - "crates/events/src/listing.rs", - 104, - )) - .with_field(optional_nullable_field( - "display_amount", - "display_amount", - TypeRef::option(core_decimal(ctx)), - "crates/events/src/listing.rs", - 105, - )) - .with_field(optional_nullable_field( - "display_unit", - "display_unit", - <Option<radroots_core::RadrootsCoreUnit> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 106, - )) - .with_field(optional_nullable_field( - "display_label", - "display_label", - <Option<String> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 107, - )) - .with_field(optional_nullable_field( - "display_price", - "display_price", - <Option<radroots_core::RadrootsCoreMoney> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 108, - )) - .with_field(optional_nullable_field( - "display_price_unit", - "display_price_unit", - <Option<radroots_core::RadrootsCoreUnit> as Dto>::describe(ctx), - "crates/events/src/listing.rs", - 109, - )); - register(ctx, "RadrootsListingBin", TypeDef::Struct(def)) - } -} - -impl Dto for RadrootsListingImageSize { - fn describe(ctx: &mut DescribeCtx) -> TypeRef { - let def = StructDef::new( - "RadrootsListingImageSize", - "RadrootsListingImageSize", - span("crates/events/src/listing.rs", 133), - ) - .with_field(field( - "w", - "w", - u32::describe(ctx), - "crates/events/src/listing.rs", - 134, - )) - .with_field(field( - "h", - "h", - u32::describe(ctx), - "crates/events/src/listing.rs", - 135, - )); - register(ctx, "RadrootsListingImageSize", TypeDef::Struct(def)) - } -} - -impl Dto for RadrootsListingImage { - fn describe(ctx: &mut DescribeCtx) -> TypeRef { - let size = RadrootsListingImageSize::describe(ctx); - let def = StructDef::new( - "RadrootsListingImage", - "RadrootsListingImage", - span("crates/events/src/listing.rs", 126), - ) - .with_field(field( - "url", - "url", - String::describe(ctx), - "crates/events/src/listing.rs", - 127, - )) - .with_field(optional_nullable_field( - "size", - "size", - TypeRef::option(size), - "crates/events/src/listing.rs", - 128, - )); - register(ctx, "RadrootsListingImage", TypeDef::Struct(def)) - } -} - impl Dto for RadrootsListingAvailability { fn describe(ctx: &mut DescribeCtx) -> TypeRef { let def = EnumDef::new( diff --git a/crates/events/src/listing.rs b/crates/events/src/listing.rs @@ -77,6 +77,8 @@ pub struct RadrootsListing { } #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))] +#[cfg_attr(feature = "dto-bindgen", dto(export))] #[derive(Clone, Debug)] pub struct RadrootsListingProduct { pub key: String, @@ -97,6 +99,8 @@ pub const RADROOTS_LISTING_PRODUCT_TAG_KEYS: [&str; 9] = [ pub struct RadrootsListingProductTagKeys; #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))] +#[cfg_attr(feature = "dto-bindgen", dto(export))] #[derive(Clone, Debug)] pub struct RadrootsListingBin { pub bin_id: RadrootsInventoryBinId, @@ -110,6 +114,7 @@ pub struct RadrootsListingBin { } #[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))] +#[cfg_attr(feature = "dto-bindgen", dto(export))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsListingPublicLocation { @@ -121,6 +126,8 @@ pub struct RadrootsListingPublicLocation { } #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))] +#[cfg_attr(feature = "dto-bindgen", dto(export))] #[derive(Clone, Debug)] pub struct RadrootsListingImage { pub url: String, @@ -128,6 +135,7 @@ pub struct RadrootsListingImage { } #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))] #[derive(Clone, Debug)] pub struct RadrootsListingImageSize { pub w: u32,