@wishcbg/bobcode
Version:
基於店家同步功能的需求,讓店家能夠在不同的店家之間同步各項功能設定,並且能夠檢視各項功能的異動情況。 規劃出一套店家設定即程式碼的機制,讓店家能夠以 config file (.sac) 來定義各項功能設定,並且能夠還原店家各項功能設定。 暫且稱這個機制為「Settings as Code」「店家設定即程式碼」。
45 lines (44 loc) • 1.95 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppointmentCategoryResourceSchema = exports.appointmentCategoryResourceSettingSchema = void 0;
const zod_1 = require("zod");
exports.appointmentCategoryResourceSettingSchema = zod_1.z.object({
name: zod_1.z.string().describe('預約類別名稱'),
order: zod_1.z.number().describe('排序').optional(),
isPublic: zod_1.z.boolean().describe('是否公開於 Client').optional(),
isPubApt: zod_1.z.boolean().describe('是否用於跨境預約').optional(),
imageId: zod_1.z.string().describe('預約類別圖片ID').optional(),
appointmentServiceLogicIds: zod_1.z.array(zod_1.z.string()).optional().describe('預約服務邏輯ID'),
}).describe('預約類別設定');
// 改成export一個 config 而不是class
exports.AppointmentCategoryResourceSchema = {
// —— 基本欄位
resourceType: 'appointmentCategory',
resourceName: '預約類別',
resourceSettingSchema: exports.appointmentCategoryResourceSettingSchema,
// —— 關聯
relationScope: 'shop',
relationType: 'multi',
relationResources: [
{
resourceType: 'appointmentService',
settingSchemaField: 'appointmentServiceLogicIds',
logicIdToResourceIdNewField: 'appointmentServices',
relationType: 'multi',
acceptsNullValue: false,
},
{
resourceType: 'image',
useLogicIdToResourceId: false,
settingSchemaField: 'imageId',
logicIdToResourceIdNewField: 'image',
relationType: 'single',
acceptsNullValue: false,
},
],
// —— apply API path
applySingleUpdateApiPath: null,
applyCreateApiPath: '/:shopId/appointmentCategory`',
applyUpdateApiPath: '/:shopId/appointmentCategory/:resourceId',
applyDestroyApiPath: '/:shopId/appointmentCategory/:resourceId',
};