jws-backend/src/controllers/customer-branch-controller.ts

97 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-04-05 11:37:40 +07:00
import { Prisma, Status } from "@prisma/client";
import {
Body,
Controller,
Delete,
Get,
Path,
Post,
Put,
Query,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { RequestWithUser } from "../interfaces/user";
import prisma from "../db";
import HttpStatus from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import minio from "../services/minio";
if (!process.env.MINIO_BUCKET) {
throw Error("Require MinIO bucket.");
}
const MINIO_BUCKET = process.env.MINIO_BUCKET;
function imageLocation(id: string) {
return `employee/profile-img-${id}`;
}
2024-04-05 11:42:03 +07:00
type CustomerBranchCreate = {
customerId: string;
code: string;
status?: Status;
branchNo: string;
legalPersonNo: string;
taxNo: string;
name: string;
nameEN: string;
addressEN: string;
address: string;
zipCode: string;
email: string;
telephoneNo: string;
longitude: string;
latitude: string;
registerName: string;
registerDate: Date;
authorizedCapital: string;
subDistrictId?: string | null;
districtId?: string | null;
provinceId?: string | null;
headOfficeId?: string | null;
};
type CustomerBranchUpdate = {
customerId?: string;
code?: string;
status?: "ACTIVE" | "INACTIVE";
branchNo?: string;
legalPersonNo?: string;
taxNo?: string;
name?: string;
nameEN?: string;
addressEN?: string;
address?: string;
zipCode?: string;
email?: string;
telephoneNo?: string;
longitude?: string;
latitude?: string;
registerName?: string;
registerDate?: Date;
authorizedCapital?: string;
subDistrictId?: string | null;
districtId?: string | null;
provinceId?: string | null;
headOfficeId?: string | null;
};
2024-04-05 11:37:40 +07:00
@Route("api/customer-branch")
@Tags("Customer Branch")
@Security("keycloak")
export class CustomerBranchController extends Controller {
}