CAFECA-IO / iSunFA

Artificial Intelligence in Financial
https://isunfa.com
GNU General Public License v3.0
0 stars 0 forks source link

[FEATURE] - 修改後端傳的ICertificate和 IInvoiceBeta #3163

Open TinyMurky opened 2 hours ago

TinyMurky commented 2 hours ago

Summary

修改後端傳的ICertificate和 IInvoiceBeta

Tasks

ICertificate

  • 原本:
    export interface ICertificate {
    id: number;
    name: string;
    companyId: number;
    unRead?: boolean; // Info: (20241108 - tzuhan) !!! not provided by backend yet @Murky
    file: IFileBeta; // Info: (20241108 - Tzuhan) !!! removed IFileBeta and update IFile
    invoice: IInvoiceBetaOptional;
    voucherNo: string | null;
    aiResultId?: string;
    aiStatus?: string;
    createdAt: number;
    updatedAt: number;
    uploader?: string; // Info: (20241108 - tzuhan) moved from IInvoiceBetaOptional
    }
  • 修改:
    export interface ICertificate {
    id: number;
    name: string;
    companyId: number;
    unRead: boolean; // Info: (20241108 - tzuhan) !!! not provided by backend yet @Murky <=去掉 ?
    file: IFileBeta; // Info: (20241108 - Tzuhan) !!! removed IFileBeta and update IFile <= 變成 IFile
    invoice: IInvoiceBetaOptional;
    voucherNo: string | null;
    aiResultId?: string;
    aiStatus?: string;
    createdAt: number;
    updatedAt: number;
    uploader?: string; // Info: (20241108 - tzuhan) moved from IInvoiceBetaOptional <=不要放在 IInvoiceBeta, 放在這裡,然後去掉?
    }

IInvoiceBeta

  • 下面這個已經是修改好的, 增加 isComplete, 去除 certificateId, 後端要多給 CounterParty
    export interface IInvoiceBeta {
    id: number;
    isComplete: boolean; // <= isComplete
    counterParty: ICounterparty; // Info: (20241108 - Tzuhan) !!! not provided by backend @Murky
    inputOrOutput: InvoiceTransactionDirection;
    date: number;
    no: string;
    currencyAlias: CurrencyType;
    priceBeforeTax: number;
    taxType: InvoiceTaxType;
    taxRatio: number;
    taxPrice: number;
    totalPrice: number;
    type: InvoiceType;
    deductible: boolean;
    createdAt: number;
    updatedAt: number;
    }

Dependencies

No response

Other Dependencies

No response

Additional Notes

No response

TinyMurky commented 2 hours ago

已確認 ICounterpartyICounterpartyValidator 相同

export interface ICounterparty {
  id: number;
  companyId: number;
  name: string;
  taxId: string;
  type: string;
  note: string;
  createdAt: number;
  updatedAt: number;
}
/**
 * Info: (20241105 - Murky)
 * @description 這個是給前端用的 ICounterparty
 */
export const ICounterpartyValidator = z.object({
  id: z.number(),
  companyId: z.number(),
  name: z.string(),
  taxId: z.string(),
  type: z.nativeEnum(CounterpartyType),
  note: z.string(),
  createdAt: z.number(),
  updatedAt: z.number(),
});
TinyMurky commented 2 hours ago

更改 IInvoiceBetaValidator來符合 IInvoiceBeta

/**
 * Info: (20241022 - tzuhan)
 * @description for frontend
 * @Murky, @Jacky 這裡是參考 data model 來更新 IInvoiceBeta 的介面,需要確認是否有遺漏或錯誤
 */
export interface IInvoiceBeta {
  id: number;
  isComplete: boolean;
  counterParty: ICounterparty; // Info: (20241108 - Tzuhan) !!! not provided by backend @Murky
  inputOrOutput: InvoiceTransactionDirection;
  date: number;
  no: string;
  currencyAlias: CurrencyType;
  priceBeforeTax: number;
  taxType: InvoiceTaxType;
  taxRatio: number;
  taxPrice: number;
  totalPrice: number;
  type: InvoiceType;
  deductible: boolean;
  createdAt: number;
  updatedAt: number;
}
/**
 * Info: (20241105 - Murky)
 * @description 這個是給前端用的 IInvoiceBeta
 */
export const IInvoiceBetaValidator = z.object({
  id: z.number(),
  isComplete: z.boolean(),
  counterParty: ICounterpartyValidator,
  inputOrOutput: z.nativeEnum(InvoiceTransactionDirection),
  date: z.number(),
  no: z.string(),
  currencyAlias: z.nativeEnum(CurrencyType),
  priceBeforeTax: z.number(),
  taxType: z.nativeEnum(InvoiceTaxType),
  taxRatio: z.number(),
  taxPrice: z.number(),
  totalPrice: z.number(),
  type: z.nativeEnum(InvoiceType),
  deductible: z.boolean(),
  createdAt: z.number(),
  updatedAt: z.number(),
  name: z.string().describe('name of invoice, not in IInvoiceBeta right now'),
});
TinyMurky commented 2 hours ago
export interface ICertificate {
  id: number;
  name: string;
  companyId: number;
  unRead: boolean; // Info: (20241108 - tzuhan) !!! not provided by backend yet @Murky
  file: IFileBeta; // Info: (20241108 - Tzuhan) !!! removed IFileBeta and update IFile
  invoice: IInvoiceBetaOptional;
  voucherNo: string | null;
  aiResultId?: string;
  aiStatus?: string;
  createdAt: number;
  updatedAt: number;
  uploader: string; // Info: (20241108 - tzuhan) moved from IInvoiceBetaOptional
}
export const ICertificateValidator = z.object({
  id: z.number(),
  name: z.string().describe('Name of certificate, but get it from Invoice'),
  companyId: z.number(),
  unRead: z.boolean(),
  file: IFileBetaValidator, // Info: (20241105 - Murky) 使用已定義的 IFileUIBetaValidator
  invoice: IInvoiceBetaValidator, // Info: (20241105 - Murky) 使用已定義的 IInvoiceBetaValidator
  voucherNo: z.string().nullable(),
  aiResultId: z.string().optional(),
  aiStatus: z.string().optional(),
  createdAt: z.number(),
  updatedAt: z.number(),
  uploader: z.string(),
});