refactor: extract root folder into variable
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 7s

This commit is contained in:
Methapon2001 2025-03-18 10:26:53 +07:00
parent 0d002e59bd
commit 11c3ce4272

View file

@ -55,78 +55,80 @@ export async function deleteFolder(path: string) {
});
}
const ROOT = ".system";
export const fileLocation = {
branch: {
line: (branchId: string) => `.system/branch/line-qr-${branchId}`,
bank: (branchId: string, bankId: string) => `.system/branch/bank-qr-${branchId}-${bankId}`,
img: (branchId: string, name?: string) => `.system/branch/img-${branchId}/${name || ""}`,
line: (branchId: string) => `${ROOT}/branch/line-qr-${branchId}`,
bank: (branchId: string, bankId: string) => `${ROOT}/branch/bank-qr-${branchId}-${bankId}`,
img: (branchId: string, name?: string) => `${ROOT}/branch/img-${branchId}/${name || ""}`,
attachment: (branchId: string, name?: string) =>
`.system/branch/attachment-${branchId}/${name || ""}`,
`${ROOT}/branch/attachment-${branchId}/${name || ""}`,
},
user: {
profile: (userId: string, name?: string) =>
`.system/user/profile-image-${userId}/${name || ""}`,
`${ROOT}/user/profile-image-${userId}/${name || ""}`,
attachment: (userId: string, name?: string) =>
`.system/user/attachment-${userId}/${name || ""}`,
`${ROOT}/user/attachment-${userId}/${name || ""}`,
},
customer: {
img: (customerId: string, name?: string) => `.system/customer/img-${customerId}/${name || ""}`,
img: (customerId: string, name?: string) => `${ROOT}/customer/img-${customerId}/${name || ""}`,
},
customerBranch: {
attachment: (customerBranchId: string, name?: string) =>
`.system/customer-branch/attachment-${customerBranchId}/${name || ""}`,
`${ROOT}/customer-branch/attachment-${customerBranchId}/${name || ""}`,
citizen: (customerBranchId: string, citizenId?: string) =>
`.system/customer-branch/citizen-${customerBranchId}/${citizenId || ""}`,
`${ROOT}/customer-branch/citizen-${customerBranchId}/${citizenId || ""}`,
houseRegistration: (customerBranchId: string, houseRegistrationId?: string) =>
`.system/customer-branch/house-registration-${customerBranchId}/${houseRegistrationId || ""}`,
`${ROOT}/customer-branch/house-registration-${customerBranchId}/${houseRegistrationId || ""}`,
commercialRegistration: (customerBranchId: string, commercialRegistrationId?: string) =>
`.system/customer-branch/commercial-registration-${customerBranchId}/${commercialRegistrationId || ""}`,
`${ROOT}/customer-branch/commercial-registration-${customerBranchId}/${commercialRegistrationId || ""}`,
vatRegistration: (customerBranchId: string, vatRegistrationId?: string) =>
`.system/customer-branch/vat-registration-${customerBranchId}/${vatRegistrationId || ""}`,
`${ROOT}/customer-branch/vat-registration-${customerBranchId}/${vatRegistrationId || ""}`,
powerOfAttorney: (customerBranchId: string, powerOfAttorneyId?: string) =>
`.system/customer-branch/power-of-attorney-${customerBranchId}/${powerOfAttorneyId || ""}`,
`${ROOT}/customer-branch/power-of-attorney-${customerBranchId}/${powerOfAttorneyId || ""}`,
},
employee: {
img: (employeeId: string, name?: string) => `.system/employee/img-${employeeId}/${name || ""}`,
img: (employeeId: string, name?: string) => `${ROOT}/employee/img-${employeeId}/${name || ""}`,
attachment: (employeeId: string, name?: string) =>
`.system/employee/attachment-${employeeId}/${name || ""}`,
`${ROOT}/employee/attachment-${employeeId}/${name || ""}`,
visa: (employeeId: string, visaId?: string) =>
`.system/employee/visa-${employeeId}/${visaId || ""}`,
`${ROOT}/employee/visa-${employeeId}/${visaId || ""}`,
passport: (employeeId: string, passportId?: string) =>
`.system/employee/passport-${employeeId}/${passportId || ""}`,
`${ROOT}/employee/passport-${employeeId}/${passportId || ""}`,
inCountryNotice: (employeeId: string, noticeId?: string) =>
`.system/employee/in-country-notice-${employeeId}/${noticeId || ""}`,
`${ROOT}/employee/in-country-notice-${employeeId}/${noticeId || ""}`,
},
product: {
img: (productId: string, name?: string) => `.system/product/img-${productId}/${name || ""}`,
img: (productId: string, name?: string) => `${ROOT}/product/img-${productId}/${name || ""}`,
},
service: {
img: (serviceId: string, name?: string) => `.system/service/img-${serviceId}/${name || ""}`,
img: (serviceId: string, name?: string) => `${ROOT}/service/img-${serviceId}/${name || ""}`,
},
quotation: {
attachment: (quotationId: string, name?: string) =>
`.system/quotation/attachment-${quotationId}/${name || ""}`,
`${ROOT}/quotation/attachment-${quotationId}/${name || ""}`,
payment: (quotationId: string, paymentId: string, name?: string) =>
`.system/quotation/payment-${quotationId}/${paymentId}/${name || ""}`,
`${ROOT}/quotation/payment-${quotationId}/${paymentId}/${name || ""}`,
},
request: {
attachment: (requestId: string, step: number, name?: string) =>
`.system/request/attachment-${requestId}-${step}/${name || ""}`,
`${ROOT}/request/attachment-${requestId}-${step}/${name || ""}`,
},
institution: {
attachment: (institutionId: string, name?: string) =>
`.system/institution/attachment-${institutionId}/${name || ""}`,
`${ROOT}/institution/attachment-${institutionId}/${name || ""}`,
img: (institutionId: string, name?: string) =>
`.system/institution/img-${institutionId}/${name || ""}`,
`${ROOT}/institution/img-${institutionId}/${name || ""}`,
},
task: {
attachment: (taskId: string, name?: string) =>
`.system/task/attachment-${taskId}/${name || ""}`,
`${ROOT}/task/attachment-${taskId}/${name || ""}`,
},
creditNote: {
slip: (creditNoteId: string, name?: string) =>
`.system/credit-note/slip-${creditNoteId}/${name || ""}`,
`${ROOT}/credit-note/slip-${creditNoteId}/${name || ""}`,
attachment: (creditNoteId: string, name?: string) =>
`.system/credit-note/attachment-${creditNoteId}/${name || ""}`,
`${ROOT}/credit-note/attachment-${creditNoteId}/${name || ""}`,
},
};