init
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "@orderops/shared",
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./*": "./src/*.ts"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export interface Address {
|
||||
fullName: string;
|
||||
line1: string;
|
||||
line2: string | null;
|
||||
city: string;
|
||||
state: string;
|
||||
postalCode: string;
|
||||
country: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export interface AuditEvent {
|
||||
id: string;
|
||||
orderId: string;
|
||||
type: string;
|
||||
message: string;
|
||||
createdAt: string;
|
||||
actor: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { UserRole } from "./user-role";
|
||||
|
||||
export interface AuthUser {
|
||||
id: string;
|
||||
username: string;
|
||||
name: string;
|
||||
role: UserRole;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface CustomerSummary {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export * from "./address";
|
||||
export * from "./audit-event";
|
||||
export * from "./auth-user";
|
||||
export * from "./customer";
|
||||
export * from "./money";
|
||||
export * from "./order-detail";
|
||||
export * from "./order-status";
|
||||
export * from "./order-summary";
|
||||
export * from "./user-role";
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface Money {
|
||||
amountCents: number;
|
||||
currency: "USD";
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { Address } from "./address";
|
||||
import type { CustomerSummary } from "./customer";
|
||||
import type { Money } from "./money";
|
||||
import type { OrderStatus } from "./order-status";
|
||||
|
||||
export interface OrderItemDetail {
|
||||
id: string;
|
||||
productId: string;
|
||||
sku: string;
|
||||
productName: string;
|
||||
quantity: number;
|
||||
unitPrice: Money;
|
||||
availableQuantity: number;
|
||||
}
|
||||
|
||||
export interface OrderDetail {
|
||||
id: string;
|
||||
orderNumber: string;
|
||||
status: OrderStatus;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
customer: CustomerSummary;
|
||||
shippingAddress: Address;
|
||||
items: OrderItemDetail[];
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export const orderStatuses = ["pending", "processing", "shipped", "cancelled", "refunded"] as const;
|
||||
|
||||
export type OrderStatus = (typeof orderStatuses)[number];
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { CustomerSummary } from "./customer";
|
||||
import type { OrderStatus } from "./order-status";
|
||||
|
||||
export interface OrderSummary {
|
||||
id: string;
|
||||
orderNumber: string;
|
||||
status: OrderStatus;
|
||||
customer: CustomerSummary;
|
||||
itemCount: number;
|
||||
createdAt: string;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export const userRoles = ["customer", "employee"] as const;
|
||||
|
||||
export type UserRole = (typeof userRoles)[number];
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user