bazzar/migration/src/types.rs

416 lines
8.0 KiB
Rust

use sea_orm::EnumIter;
use sea_orm_migration::prelude::*;
#[macro_export]
macro_rules! create_type {
($manager: ident, $ty: ident) => {{
use crate::extension::postgres::Type;
use crate::types::*;
$manager
.create_type(
Type::create()
.as_enum($ty::iter().next().unwrap())
.values($ty::iter().skip(1))
.to_owned(),
)
.await?;
}};
}
#[macro_export]
macro_rules! drop_type {
($manager: ident, $ty: ident) => {{
use crate::extension::postgres::Type;
use crate::types::*;
$manager
.drop_type(
Type::drop()
.if_exists()
.cascade()
.name($ty::iter().next().unwrap())
.to_owned(),
)
.await?;
}};
}
#[derive(Iden, EnumIter)]
pub enum PaymentCollectionStatus {
PaymentCollectionStatuses,
#[iden = "not_paid"]
NotPaid,
#[iden = "awaiting"]
Awaiting,
#[iden = "authorized"]
Authorized,
#[iden = "partially_authorized"]
PartiallyAuthorized,
#[iden = "canceled"]
Canceled,
}
#[derive(Iden, EnumIter)]
pub enum PaymentCollectionType {
PaymentCollectionTypes,
#[iden = "order_edit"]
OrderEdit,
}
#[derive(Iden, EnumIter)]
pub enum CartType {
CartTypes,
#[iden = "default"]
Default,
#[iden = "swap"]
Swap,
#[iden = "draft_order"]
DraftOrder,
#[iden = "payment_link"]
PaymentLink,
#[iden = "claim"]
Claim,
}
#[derive(Iden, EnumIter)]
pub enum ClaimItemReason {
ClaimItemReasons,
#[iden = "missing_item"]
MissingItem,
#[iden = "wrong_item"]
WrongItem,
#[iden = "production_failure"]
ProductionFailure,
#[iden = "other"]
Other,
}
#[derive(Iden, EnumIter)]
pub enum ClaimOrderFulfillmentStatus {
ClaimOrderFulfillmentStatuses,
#[iden = "not_fulfilled"]
NotFulfilled,
#[iden = "partially_fulfilled"]
PartiallyFulfilled,
#[iden = "fulfilled"]
Fulfilled,
#[iden = "partially_shipped"]
PartiallyShipped,
#[iden = "shipped"]
Shipped,
#[iden = "partially_returned"]
PartiallyReturned,
#[iden = "returned"]
Returned,
#[iden = "canceled"]
Canceled,
#[iden = "requires_action"]
RequiresAction,
}
#[derive(Iden, EnumIter)]
pub enum ClaimOrderPaymentStatus {
ClaimOrderPaymentStatuses,
#[iden = "na"]
NA,
#[iden = "not_refunded"]
NotRefunded,
#[iden = "refunded"]
Refunded,
}
#[derive(Iden, EnumIter)]
pub enum ClaimOrderType {
ClaimOrderTypes,
#[iden = "refund"]
Refund,
#[iden = "replace"]
Replace,
}
#[derive(Iden, EnumIter)]
pub enum DiscountConditionOperator {
DiscountConditionOperators,
#[iden = "in"]
In,
#[iden = "not_in"]
NotOn,
}
#[derive(Iden, EnumIter)]
pub enum DiscountConditionType {
DiscountConditionTypes,
#[iden = "products"]
Products,
#[iden = "product_types"]
ProductTypes,
#[iden = "product_collections"]
ProductCollections,
#[iden = "product_tags"]
ProductTags,
#[iden = "customer_groups"]
CustomerGroups,
}
#[derive(Iden, EnumIter)]
pub enum DiscountRuleAllocation {
DiscountRuleAllocations,
#[iden = "total"]
Total,
#[iden = "item"]
Item,
}
#[derive(Iden, EnumIter)]
pub enum DiscountRuleType {
DiscountRuleTypes,
#[iden = "fixed"]
Fixed,
#[iden = "percentage"]
Percentage,
#[iden = "free_shipping"]
FreeShipping,
}
#[derive(Iden, EnumIter)]
pub enum DraftOrderStatus {
DraftOrderStatuses,
#[iden = "open"]
Open,
#[iden = "completed"]
Completed,
}
#[derive(Iden, EnumIter)]
pub enum InviteRole {
InviteRoles,
#[iden = "admin"]
Admin,
#[iden = "member"]
Member,
#[iden = "developer"]
Developer,
}
#[derive(Iden, EnumIter)]
pub enum OrderFulfillmentStatus {
OrderFulfillmentStatuses,
#[iden = "not_fulfilled"]
NotFulfilled,
#[iden = "partially_fulfilled"]
PartiallyFulfilled,
#[iden = "fulfilled"]
Fulfilled,
#[iden = "partially_shipped"]
PartiallyShipped,
#[iden = "shipped"]
Shipped,
#[iden = "partially_returned"]
PartiallyReturned,
#[iden = "returned"]
Returned,
#[iden = "canceled"]
Canceled,
#[iden = "requires_action"]
RequiresAction,
}
#[derive(Iden, EnumIter)]
pub enum OrderItemChangeType {
OrderItemChangeTypes,
#[iden = "item_add"]
ItemAdd,
#[iden = "item_remove"]
ItemRemove,
#[iden = "item_update"]
ItemUpdate,
}
#[derive(Iden, EnumIter)]
pub enum OrderPaymentStatus {
OrderPaymentStatuses,
#[iden = "not_paid"]
NotPaid,
#[iden = "awaiting"]
Awaiting,
#[iden = "captured"]
Captured,
#[iden = "partially_refunded"]
PartiallyRefunded,
#[iden = "refunded"]
Refunded,
#[iden = "canceled"]
Canceled,
#[iden = "requires_action"]
RequiresAction,
}
#[derive(Iden, EnumIter)]
pub enum OrderStatus {
OrderStatuses,
#[iden = "pending"]
Pending,
#[iden = "completed"]
Completed,
#[iden = "archived"]
Archived,
#[iden = "canceled"]
Canceled,
#[iden = "requires_action"]
RequiresAction,
}
#[derive(Iden, EnumIter)]
pub enum PaymentSessionStatus {
PaymentSessionStatuses,
#[iden = "authorized"]
Authorized,
#[iden = "pending"]
Pending,
#[iden = "requires_more"]
RequiresMore,
#[iden = "error"]
Error,
#[iden = "canceled"]
Canceled,
}
#[derive(Iden, EnumIter)]
pub enum PriceListStatus {
PriceListStatuses,
#[iden = "active"]
Active,
#[iden = "draft"]
Draft,
}
#[derive(Iden, EnumIter)]
pub enum PriceListType {
PriceListTypes,
#[iden = "sale"]
Sale,
#[iden = "override"]
Override,
}
#[derive(Iden, EnumIter)]
pub enum ProductStatus {
ProductStatuses,
#[iden = "draft"]
Draft,
#[iden = "proposed"]
Proposed,
#[iden = "published"]
Published,
#[iden = "rejected"]
Rejected,
}
#[derive(Iden, EnumIter)]
pub enum RefundReason {
RefundReasons,
#[iden = "discount"]
Discount,
#[iden = "return"]
Return,
#[iden = "swap"]
Swap,
#[iden = "claim"]
Claim,
#[iden = "other"]
Other,
}
#[derive(Iden, EnumIter)]
pub enum ReturnStatus {
ReturnStatuses,
#[iden = "requested"]
Requested,
#[iden = "received"]
Received,
#[iden = "requires_action"]
RequiresAction,
#[iden = "canceled"]
Canceled,
}
#[derive(Iden, EnumIter)]
pub enum ShippingOptionPriceType {
ShippingOptionPriceTypes,
#[iden = "flat_rate"]
FlatRate,
#[iden = "calculated"]
Calculated,
}
#[derive(Iden, EnumIter)]
pub enum ShippingOptionRequirementType {
ShippingOptionRequirementTypes,
#[iden = "min_subtotal"]
MinSubtotal,
#[iden = "max_subtotal"]
MaxSubtotal,
}
#[derive(Iden, EnumIter)]
pub enum ShippingProfileType {
ShippingProfileTypes,
#[iden = "default"]
Default,
#[iden = "gift_card"]
GiftCard,
#[iden = "custom"]
Custom,
}
#[derive(Iden, EnumIter)]
pub enum SwapFulfillmentStatus {
SwapFulfillmentStatuses,
#[iden = "not_fulfilled"]
NotFulfilled,
#[iden = "fulfilled"]
Fulfilled,
#[iden = "shipped"]
Shipped,
#[iden = "partially_shipped"]
PartiallyShipped,
#[iden = "canceled"]
Canceled,
#[iden = "requires_action"]
RequiresAction,
}
#[derive(Iden, EnumIter)]
pub enum SwapPaymentStatus {
SwapPaymentStatuses,
#[iden = "not_paid"]
NotPaid,
#[iden = "awaiting"]
Awaiting,
#[iden = "captured"]
Captured,
#[iden = "confirmed"]
Confirmed,
#[iden = "canceled"]
Canceled,
#[iden = "difference_refunded"]
DifferenceRefunded,
#[iden = "partially_refunded"]
PartiallyRefunded,
#[iden = "refunded"]
Refunded,
#[iden = "requires_action"]
RequiresAction,
}
#[derive(Iden, EnumIter)]
pub enum UserRole {
UserRoles,
#[iden = "admin"]
Admin,
#[iden = "member"]
Member,
#[iden = "developer"]
Developer,
}