UNPKG

@wishcbg/bobcode

Version:

基於店家同步功能的需求,讓店家能夠在不同的店家之間同步各項功能設定,並且能夠檢視各項功能的異動情況。 規劃出一套店家設定即程式碼的機制,讓店家能夠以 config file (.sac) 來定義各項功能設定,並且能夠還原店家各項功能設定。 暫且稱這個機制為「Settings as Code」「店家設定即程式碼」。

39 lines (38 loc) 1.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppointmentServiceAttachResourceSchema = exports.appointmentServiceAttachResourceSettingSchema = void 0; const zod_1 = require("zod"); exports.appointmentServiceAttachResourceSettingSchema = zod_1.z.object({ name: zod_1.z.string().describe('附加服務名稱'), price: zod_1.z.number().int().describe('附加服務價格'), showPrice: zod_1.z.string().describe('顯示價格'), showTime: zod_1.z.number().int().describe('顯示服務時間'), bookingTime: zod_1.z.number().int().describe('庫存佔用時間'), order: zod_1.z.number().int().default(0).describe('排序'), isPublic: zod_1.z.boolean().default(true).describe('是否公開顯示'), isPubApt: zod_1.z.boolean().default(false).describe('是否用於跨境預約'), appointmentServiceLogicIds: zod_1.z.array(zod_1.z.string()).optional().describe('預約服務邏輯ID'), }).describe('附加預約服務'); // 改成export一個 config 而不是class exports.AppointmentServiceAttachResourceSchema = { // —— 基本欄位 resourceType: 'appointmentServiceAttach', resourceName: '附加預約服務', resourceSettingSchema: exports.appointmentServiceAttachResourceSettingSchema, // —— 關聯 relationScope: 'shop', relationType: 'multi', relationResources: [ { resourceType: 'appointmentService', settingSchemaField: 'appointmentServiceLogicIds', logicIdToResourceIdNewField: 'appointmentServices', relationType: 'multi', }, ], // —— apply API path applySingleUpdateApiPath: null, applyCreateApiPath: '/:shopId/appointmentServiceAttach', applyUpdateApiPath: '/:shopId/appointmentServiceAttach/:resourceId', applyDestroyApiPath: '/:shopId/appointmentServiceAttach/:resourceId', };