2025-05-14 21:45:16 +02:00

86 lines
3.6 KiB
TypeScript

import { registerEnumType, ObjectType, Field, InputType, Int } from 'type-graphql';
import { PaymentStatusEnum } from './components.payments';
import { AvailableTranslation } from '@src/__components/components';
/*
███████╗███╗ ██╗██╗ ██╗███╗ ███╗
██╔════╝████╗ ██║██║ ██║████╗ ████║
█████╗ ██╔██╗ ██║██║ ██║██╔████╔██║
██╔══╝ ██║╚██╗██║██║ ██║██║╚██╔╝██║
███████╗██║ ╚████║╚██████╔╝██║ ╚═╝ ██║
╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝
*/
export enum OrderTypeEnum {
online = 'online',
withShipping = 'withShipping',
}
registerEnumType(OrderTypeEnum, {
name: 'OrderType',
});
export enum OrderStatusEnum {
draft = 'draft',
processing = 'processing',
shipped = 'shipped',
completed = 'completed',
canceled = 'canceled',
refund = 'refund',
}
registerEnumType(OrderStatusEnum, {
name: 'OrderStatusEnum',
});
export enum OrderBusinessStatusEnum {
processing = 'processing',
shipped = 'shipped',
completed = 'completed',
canceled = 'canceled',
refund = 'refund',
}
registerEnumType(OrderBusinessStatusEnum, {
name: 'OrderBusinessStatusEnum',
});
/*
██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗███████╗
██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝██╔════╝
██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║ ███████╗
██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║ ╚════██║
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║ ███████║
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝
*/
@ObjectType()
@InputType('LocaleInfoInput')
export class LocaleInfo {
@Field({ nullable: true })
countryCode?: string;
@Field(() => AvailableTranslation, { nullable: true })
locale?: AvailableTranslation;
}
@ObjectType()
export class OrderInfoComponent {
@Field()
_id: string;
@Field(() => OrderStatusEnum)
orderStatus: OrderStatusEnum;
@Field(() => PaymentStatusEnum)
paymentStatus: PaymentStatusEnum;
}
@ObjectType()
@InputType('AddOnInput')
export class AddOnComponent {
@Field()
addOnId: string;
@Field()
quantity: number;
}