From e303464d7ca16fd6e61c63b7ca875883e28d69d0 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 25 Jun 2024 15:46:02 +0700 Subject: [PATCH] fix: type --- src/stores/branch-contact/index.ts | 24 +++++----- src/stores/branch/index.ts | 66 +++++++++++++------------- src/stores/customer/index.ts | 72 ++++++++++++++--------------- src/stores/employee/index.ts | 54 +++++++++++----------- src/stores/product-service/index.ts | 30 ++++++------ src/stores/user/index.ts | 72 ++++++++++++++--------------- 6 files changed, 159 insertions(+), 159 deletions(-) diff --git a/src/stores/branch-contact/index.ts b/src/stores/branch-contact/index.ts index 91742da1..9355442a 100644 --- a/src/stores/branch-contact/index.ts +++ b/src/stores/branch-contact/index.ts @@ -29,9 +29,9 @@ const useBranchContactStore = defineStore('api-branch-contact', () => { pageSize?: number; }, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const params = new URLSearchParams(); @@ -65,9 +65,9 @@ const useBranchContactStore = defineStore('api-branch-contact', () => { branchId: string, data: BranchContactCreate, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.post< @@ -91,9 +91,9 @@ const useBranchContactStore = defineStore('api-branch-contact', () => { data: Partial, qrCodeImage?: File, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const { ...payload } = data; @@ -128,9 +128,9 @@ const useBranchContactStore = defineStore('api-branch-contact', () => { branchId: string, contactId: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.delete< diff --git a/src/stores/branch/index.ts b/src/stores/branch/index.ts index 4e5b5147..a449d182 100644 --- a/src/stores/branch/index.ts +++ b/src/stores/branch/index.ts @@ -37,9 +37,9 @@ const useBranchStore = defineStore('api-branch', () => { >( opts?: Options, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ): Promise { const params = new URLSearchParams(); @@ -86,9 +86,9 @@ const useBranchStore = defineStore('api-branch', () => { id: string, opts?: Options, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ): Promise { const params = new URLSearchParams(); @@ -119,9 +119,9 @@ const useBranchStore = defineStore('api-branch', () => { async function create( branch: BranchCreate, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const { qrCodeImage, imageUrl, ...payload } = branch; @@ -168,9 +168,9 @@ const useBranchStore = defineStore('api-branch', () => { qrCodeImage?: File | undefined, imageHq?: File | undefined, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const { ...payload } = data; @@ -210,9 +210,9 @@ const useBranchStore = defineStore('api-branch', () => { async function deleteById( id: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.delete(`/branch/${id}`, { @@ -232,9 +232,9 @@ const useBranchStore = defineStore('api-branch', () => { async function getUser( branchId: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get(`/branch/${branchId}/user`, { @@ -255,9 +255,9 @@ const useBranchStore = defineStore('api-branch', () => { branchId: string, userId: string | string[], flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.post( @@ -282,9 +282,9 @@ const useBranchStore = defineStore('api-branch', () => { branchId: string, userId: string | string[], flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.delete(`/branch/${branchId}/user`, { @@ -303,9 +303,9 @@ const useBranchStore = defineStore('api-branch', () => { } async function stats(flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }) { const res = await api.get<{ hq: number; @@ -327,9 +327,9 @@ const useBranchStore = defineStore('api-branch', () => { async function userStats( userType: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get( @@ -353,9 +353,9 @@ const useBranchStore = defineStore('api-branch', () => { branchId: BranchId, force = false, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { if (!force && contact[branchId]) return contact[branchId]; diff --git a/src/stores/customer/index.ts b/src/stores/customer/index.ts index c8d3c93f..47d0d0e7 100644 --- a/src/stores/customer/index.ts +++ b/src/stores/customer/index.ts @@ -21,9 +21,9 @@ const useCustomerStore = defineStore('api-customer', () => { async function fetchListById( customerId: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get( @@ -63,9 +63,9 @@ const useCustomerStore = defineStore('api-customer', () => { >( opts?: Options, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ): Promise { const params = new URLSearchParams(); @@ -113,9 +113,9 @@ const useCustomerStore = defineStore('api-customer', () => { >( opts?: Options, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ): Promise { const params = new URLSearchParams(); @@ -146,9 +146,9 @@ const useCustomerStore = defineStore('api-customer', () => { } async function getStatsCustomer(flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }) { const res = await api.get('/customer/type-stats', { headers: { @@ -165,9 +165,9 @@ const useCustomerStore = defineStore('api-customer', () => { async function create( data: CustomerCreate, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const { image, ...payload } = data; @@ -217,9 +217,9 @@ const useCustomerStore = defineStore('api-customer', () => { id: string, data: Partial, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const { image, ...payload } = data; @@ -268,9 +268,9 @@ const useCustomerStore = defineStore('api-customer', () => { async function deleteById( id: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.delete(`/customer/${id}`, { @@ -290,9 +290,9 @@ const useCustomerStore = defineStore('api-customer', () => { async function createBranch( data: CustomerBranchCreate & { customerId: string }, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.post< @@ -317,9 +317,9 @@ const useCustomerStore = defineStore('api-customer', () => { id: string, data: Partial, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.put< @@ -341,9 +341,9 @@ const useCustomerStore = defineStore('api-customer', () => { async function deleteBranchById( id: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.delete(`/customer-branch/${id}`, { @@ -364,9 +364,9 @@ const useCustomerStore = defineStore('api-customer', () => { branchId: string, payload: BranchAttachmentCreate, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const list: { name: string; file: File }[] = []; @@ -425,9 +425,9 @@ const useCustomerStore = defineStore('api-customer', () => { async function fetchListBranchById( branchId: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get(`/customer-branch/${branchId}`, { diff --git a/src/stores/employee/index.ts b/src/stores/employee/index.ts index 82c666e7..46001206 100644 --- a/src/stores/employee/index.ts +++ b/src/stores/employee/index.ts @@ -26,9 +26,9 @@ const useEmployeeStore = defineStore('api-employee', () => { status?: 'CREATED' | 'ACTIVE' | 'INACTIVE'; }, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const params = new URLSearchParams(); @@ -64,9 +64,9 @@ const useEmployeeStore = defineStore('api-employee', () => { async function create( data: EmployeeCreate, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const { image, ...payload } = data; @@ -97,9 +97,9 @@ const useEmployeeStore = defineStore('api-employee', () => { id: string, data: Partial, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const { image, ...payload } = data; @@ -129,9 +129,9 @@ const useEmployeeStore = defineStore('api-employee', () => { async function deleteById( id: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.delete(`/employee/${id}`, { @@ -151,9 +151,9 @@ const useEmployeeStore = defineStore('api-employee', () => { async function fetchCheckup( id: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get(`/employee/${id}/checkup`, { @@ -171,9 +171,9 @@ const useEmployeeStore = defineStore('api-employee', () => { async function fetchWork( id: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get(`/employee/${id}/work`, { @@ -191,9 +191,9 @@ const useEmployeeStore = defineStore('api-employee', () => { async function fetchOther( id: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get(`/employee/${id}/other-info`, { @@ -211,9 +211,9 @@ const useEmployeeStore = defineStore('api-employee', () => { async function getStatsEmployee( customerBranchId?: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get( @@ -234,9 +234,9 @@ const useEmployeeStore = defineStore('api-employee', () => { async function getStatsEmployeeGender( customerBranchId?: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get( diff --git a/src/stores/product-service/index.ts b/src/stores/product-service/index.ts index 17634ac2..32651a4f 100644 --- a/src/stores/product-service/index.ts +++ b/src/stores/product-service/index.ts @@ -58,9 +58,9 @@ const useProductServiceStore = defineStore('api-product-service', () => { status?: 'CREATED' | 'ACTIVE' | 'INACTIVE'; }, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const params = new URLSearchParams(); @@ -172,9 +172,9 @@ const useProductServiceStore = defineStore('api-product-service', () => { async function fetchListProductService( opts?: { query?: string; status?: 'CREATED' | 'ACTIVE' | 'INACTIVE' }, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const params = new URLSearchParams(); @@ -282,9 +282,9 @@ const useProductServiceStore = defineStore('api-product-service', () => { status?: string; }, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const params = new URLSearchParams(); @@ -410,9 +410,9 @@ const useProductServiceStore = defineStore('api-product-service', () => { status?: string; }, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const params = new URLSearchParams(); @@ -473,9 +473,9 @@ const useProductServiceStore = defineStore('api-product-service', () => { serviceId: string, opts?: { query?: string; page?: number; pageSize?: number }, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const params = new URLSearchParams(); diff --git a/src/stores/user/index.ts b/src/stores/user/index.ts index 6456f130..524938cf 100644 --- a/src/stores/user/index.ts +++ b/src/stores/user/index.ts @@ -137,9 +137,9 @@ const useUserStore = defineStore('api-user', () => { async function fetchAttachment( userId: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get(`/user/${userId}/attachment`, { @@ -160,9 +160,9 @@ const useUserStore = defineStore('api-user', () => { userId: string, payload: UserAttachmentCreate, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const list: { name: string; file: File }[] = []; @@ -222,9 +222,9 @@ const useUserStore = defineStore('api-user', () => { userId: string, payload: UserAttachmentDelete, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { await api.delete(`/user/${userId}/attachment`, { @@ -247,9 +247,9 @@ const useUserStore = defineStore('api-user', () => { userType?: string; }, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const params = new URLSearchParams(); @@ -286,9 +286,9 @@ const useUserStore = defineStore('api-user', () => { async function fetchById( id: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get(`/user/${id}`, { @@ -309,9 +309,9 @@ const useUserStore = defineStore('api-user', () => { async function create( data: UserCreate, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const { profileImage, ...payload } = data; @@ -344,9 +344,9 @@ const useUserStore = defineStore('api-user', () => { id: string, data: Partial, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const { profileImage, ...payload } = data; @@ -378,9 +378,9 @@ const useUserStore = defineStore('api-user', () => { async function deleteById( id: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.delete(`/user/${id}`, { @@ -400,9 +400,9 @@ const useUserStore = defineStore('api-user', () => { async function getBranch( userId: string, flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.get>(`/user/${userId}/branch`, { @@ -423,9 +423,9 @@ const useUserStore = defineStore('api-user', () => { userId: string, branchId: string | string[], flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.post( @@ -450,9 +450,9 @@ const useUserStore = defineStore('api-user', () => { userId: string, branchId: string | string[], flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }, ) { const res = await api.delete(`/user/${userId}/branch`, { @@ -471,9 +471,9 @@ const useUserStore = defineStore('api-user', () => { } async function typeStats(flow?: { - sessionId: string; - refTransactionId: string; - transactionId: string; + sessionId?: string; + refTransactionId?: string; + transactionId?: string; }) { const res = await api.get('/user/type-stats', { headers: {