Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/api/generated/api/catalog_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ class CatalogApi {
/// Carries the variants with their prices and stock and the seller summary. A listing that was never public — `draft` or `pending` — is readable only by its owner and by staff. One that is `hidden` or soft-deleted is readable by anyone, because a cart or an order that references it still has to render; `status` and `deleted_at` say that it cannot be bought.
///
/// Parameters:
/// * [id] - The listing's opaque id or its slug. A slug is lowercase, hyphen-separated and never contains an underscore, so it cannot be mistaken for an id — but only the id is accepted today; resolving a slug needs a lookup this route does not have yet.
/// * [id] - The listing's opaque id or the slug a link carries. A slug is lowercase, hyphen-separated and never contains an underscore, so it cannot be mistaken for an id; it resolves without a lookup, because it carries the id on the end.
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
/// * [headers] - Can be used to add additional headers to the request
/// * [extras] - Can be used to add flags to the request
Expand Down Expand Up @@ -502,7 +502,7 @@ class CatalogApi {
}

/// Edit a listing
/// An edit to a draft applies immediately. An edit to a live listing that trips the prohibited-goods filter is held as a pending edit and applied only when a moderator approves it, so the version buyers see never changes into unreviewed content. The slug is fixed at creation. Renaming a listing leaves it alone: there is no redirect table, so a new slug would only turn every link already shared into a 404, and `GET /listings/{id}` takes the id as well.
/// An edit to a draft applies immediately. An edit to a live listing that trips the prohibited-goods filter is held as a pending edit and applied only when a moderator approves it, so the version buyers see never changes into unreviewed content. The slug's readable half is fixed at creation. Renaming a listing leaves it alone, so a link shared before the rename keeps saying what it said then — and it would resolve either way, since the id it carries is what addresses the listing.
///
/// Parameters:
/// * [id] - The opaque id. A write addresses the listing, never its public slug.
Expand Down
2 changes: 0 additions & 2 deletions lib/api/generated/deserialize.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ ReturnType deserialize<ReturnType, BaseType>(
bool growable = true,
}) {
switch (targetType) {
case 'String':
return '$value' as ReturnType;
case 'int':
return (value is int ? value : int.parse('$value')) as ReturnType;
case 'bool':
Expand Down
2 changes: 1 addition & 1 deletion lib/api/generated/model/listing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Listing {
@JsonKey(name: r'seller', required: true, includeIfNull: false)
final AccountSummary seller;

/// URL-friendly, globally unique and fixed at creation.
/// The slug a link carries: the listing's name, slugified and frozen at creation, with the listing's id on the end. The text in front is for the person reading the link and is not matched — renaming a listing does not rewrite links already shared, and a stale one still resolves because the id behind the last hyphen is what addresses the listing. It never contains an underscore, which is how `GET /listings/{id}` tells it from a `ListingID` and accepts either. A name that slugifies to nothing leaves the id alone.
@JsonKey(name: r'slug', required: true, includeIfNull: false)
final String slug;

Expand Down
1 change: 1 addition & 0 deletions lib/api/generated/model/listing_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class ListingDetail {
@JsonKey(name: r'seller', required: true, includeIfNull: false)
final AccountSummary seller;

/// The slug a link carries: the listing's name, slugified and frozen at creation, with the listing's id on the end. The text in front is for the person reading the link and is not matched — renaming a listing does not rewrite links already shared, and a stale one still resolves because the id behind the last hyphen is what addresses the listing. It never contains an underscore, which is how `GET /listings/{id}` tells it from a `ListingID` and accepts either. A name that slugifies to nothing leaves the id alone.
@JsonKey(name: r'slug', required: true, includeIfNull: false)
final String slug;

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ abstract class CheckoutState with _$CheckoutState {
/// checkout that breaks the day an operator retires that rail.
@Default([]) List<Option> paymentOptions,
String? paymentOption,
String? note,
CheckoutResult? checkoutResult,
Transaction? paymentTransaction,
PaymentSession? paymentSession,
Expand Down Expand Up @@ -385,6 +386,11 @@ class CheckoutNotifier extends _$CheckoutNotifier {
}
}

/// Cập nhật lời nhắn cho người bán
void setNote(String note) {
state = state.copyWith(note: note);
}

/// Thay đổi trạng thái đồng ý điều khoản dịch vụ
void toggleAgreeToTerms({bool? value}) {
state = state.copyWith(
Expand Down Expand Up @@ -424,6 +430,9 @@ class CheckoutNotifier extends _$CheckoutNotifier {
for (final line in state.lines)
CheckoutLine(variantId: line.variantId, quantity: line.quantity),
],
note: (state.note?.trim().isNotEmpty == true)
? state.note!.trim()
: null,
transportOption: state.transportOption!,
),
);
Expand Down
Loading
Loading