Some checks failed
farmcontrol/farmcontrol-api/pipeline/head There was a failure building this commit
This commit modifies the log level in the configuration file from "trace" to "debug" for improved logging clarity. It also introduces new routes for fulfillment, return, and payment policies in the index file, enhancing the marketplace integration capabilities. Additionally, the initialization process is updated to start the marketplace worker, ensuring that the application can handle marketplace operations effectively. Various schemas are updated to include new fields and relationships for policies, improving the overall functionality and flexibility of the marketplace management system.
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
import mongoose from 'mongoose';
|
|
import { generateId } from '../../utils.js';
|
|
import { marketplaceSyncMappingSchema } from './marketplaceMapping.schema.js';
|
|
|
|
const { Schema } = mongoose;
|
|
|
|
const fulfillmentPolicySchema = new Schema(
|
|
{
|
|
_reference: { type: String, default: () => generateId()() },
|
|
name: { type: String, required: true },
|
|
description: { type: String, required: false },
|
|
handlingTime: { type: Number, required: false, default: 1 },
|
|
localPickup: { type: Boolean, required: false, default: false },
|
|
globalShipping: { type: Boolean, required: false, default: false },
|
|
freightShipping: { type: Boolean, required: false, default: false },
|
|
pickupDropOff: { type: Boolean, required: false, default: false },
|
|
courierServices: [{ type: Schema.Types.ObjectId, ref: 'courierService', required: false }],
|
|
marketplaces: { type: [marketplaceSyncMappingSchema()], default: [] },
|
|
},
|
|
{ timestamps: true }
|
|
);
|
|
|
|
fulfillmentPolicySchema.index({ name: 'text', description: 'text' });
|
|
|
|
fulfillmentPolicySchema.virtual('id').get(function () {
|
|
return this._id;
|
|
});
|
|
|
|
fulfillmentPolicySchema.set('toJSON', { virtuals: true });
|
|
|
|
export const fulfillmentPolicyModel = mongoose.model('fulfillmentPolicy', fulfillmentPolicySchema);
|