and so it begins
This commit is contained in:
@@ -10,25 +10,3 @@ export const numberModel = z
|
||||
.transform((value) => {
|
||||
return value !== undefined && isNaN(value) ? undefined : value;
|
||||
});
|
||||
|
||||
export const airportModel = z.object({
|
||||
id: z.coerce.number().int(),
|
||||
ident: z.string().nullable().optional(),
|
||||
type: z.string(),
|
||||
name: z.string(),
|
||||
latitudeDeg: numberModel.default(0.0),
|
||||
longitudeDeg: numberModel.default(0.0),
|
||||
elevationFt: numberModel.default(0.0),
|
||||
continent: z.string(),
|
||||
isoCountry: z.string(),
|
||||
country: z.string(),
|
||||
isoRegion: z.string(),
|
||||
municipality: z.string(),
|
||||
scheduledService: z.string(),
|
||||
gpsCode: z.coerce.string().default("----"),
|
||||
iataCode: z.coerce.string().min(1),
|
||||
localCode: z.coerce.string().default("----"),
|
||||
createdAt: z.coerce.date(),
|
||||
updatedAt: z.coerce.date(),
|
||||
});
|
||||
export type Airport = z.infer<typeof airportModel>;
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
type Database,
|
||||
} from "@pkg/db";
|
||||
import { coupon } from "@pkg/db/schema";
|
||||
import { ERROR_CODES, type Result } from "@pkg/result";
|
||||
import { getError, Logger } from "@pkg/logger";
|
||||
import { ERROR_CODES, type Result } from "@pkg/result";
|
||||
import {
|
||||
couponModel,
|
||||
type CouponModel,
|
||||
|
||||
14
packages/logic/domains/product/data.ts
Normal file
14
packages/logic/domains/product/data.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const productModel = z.object({
|
||||
id: z.string(),
|
||||
linkId: z.string(),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
longDescription: z.string(),
|
||||
price: z.number(),
|
||||
discountPrice: z.number(),
|
||||
createdAt: z.coerce.string().optional(),
|
||||
updatedAt: z.coerce.string().optional(),
|
||||
});
|
||||
export type ProductModel = z.infer<typeof productModel>;
|
||||
15
packages/logic/domains/product/repository.ts
Normal file
15
packages/logic/domains/product/repository.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Database } from "@pkg/db";
|
||||
|
||||
export class ProductRepository {
|
||||
private db: Database;
|
||||
|
||||
constructor(db: Database) {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
// TODO: compelte the crud method implementation
|
||||
async listAllProducts() {}
|
||||
async createProduct() {}
|
||||
async updateProduct() {}
|
||||
async deleteProduct() {}
|
||||
}
|
||||
Reference in New Issue
Block a user