Files
domain-wall/packages/logic/domains/customerinfo/usecases.ts

39 lines
943 B
TypeScript

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 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));
}