big boi refactor to customer inof from passenger info
This commit is contained in:
42
packages/logic/domains/customerinfo/usecases.ts
Normal file
42
packages/logic/domains/customerinfo/usecases.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { db } from "@pkg/db";
|
||||
import type {
|
||||
CreateCustomerInfoPayload,
|
||||
UpdateCustomerInfoPayload,
|
||||
} from "./data";
|
||||
import { CustomerInfoRepository } from "./repository";
|
||||
|
||||
export class CustomerInfoUseCases {
|
||||
private repo: CustomerInfoRepository;
|
||||
|
||||
constructor(repo: CustomerInfoRepository) {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
async getAllCustomerInfo() {
|
||||
return this.repo.getAllCustomerInfo();
|
||||
}
|
||||
|
||||
async getCustomerInfoById(id: number) {
|
||||
return this.repo.getCustomerInfoById(id);
|
||||
}
|
||||
|
||||
async getCustomerInfoByOrderId(orderId: number) {
|
||||
return this.repo.getCustomerInfoByOrderId(orderId);
|
||||
}
|
||||
|
||||
async createCustomerInfo(payload: CreateCustomerInfoPayload) {
|
||||
return this.repo.createCustomerInfo(payload);
|
||||
}
|
||||
|
||||
async updateCustomerInfo(payload: UpdateCustomerInfoPayload) {
|
||||
return this.repo.updateCustomerInfo(payload);
|
||||
}
|
||||
|
||||
async deleteCustomerInfo(id: number) {
|
||||
return this.repo.deleteCustomerInfo(id);
|
||||
}
|
||||
}
|
||||
|
||||
export function getCustomerInfoUseCases() {
|
||||
return new CustomerInfoUseCases(new CustomerInfoRepository(db));
|
||||
}
|
||||
Reference in New Issue
Block a user