All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- Updated the `notificationUserFromOwner` function to support 'marketplace' as a valid owner type. - Added a new `marketplaceEvent` schema to manage marketplace events, including fields for `externalReference`, `topic`, and `status`. - Enhanced existing schemas (e.g., `orderitem`, `shipment`, `client`, `listing`, `listingVarient`, `salesOrder`, `courierService`) to include `externalReference` fields for better integration with external systems. - Introduced unique indexes for `externalReference` in relevant schemas to ensure data integrity and prevent duplicates. - Improved the `marketplace` schema to include additional fields for eBay shipping services, enhancing its configurability.
33 lines
827 B
JavaScript
33 lines
827 B
JavaScript
import mongoose from 'mongoose';
|
|
import { generateId } from '../../utils.js';
|
|
|
|
const courierSchema = new mongoose.Schema(
|
|
{
|
|
_reference: { type: String, default: () => generateId()() },
|
|
name: { required: true, type: String },
|
|
website: { required: false, type: String },
|
|
email: { required: false, type: String },
|
|
phone: { required: false, type: String },
|
|
contact: { required: false, type: String },
|
|
country: { required: false, type: String },
|
|
},
|
|
{ timestamps: true }
|
|
);
|
|
|
|
courierSchema.index({
|
|
name: 'text',
|
|
website: 'text',
|
|
email: 'text',
|
|
phone: 'text',
|
|
contact: 'text',
|
|
country: 'text',
|
|
});
|
|
|
|
courierSchema.virtual('id').get(function () {
|
|
return this._id;
|
|
});
|
|
|
|
courierSchema.set('toJSON', { virtuals: true });
|
|
|
|
export const courierModel = mongoose.model('courier', courierSchema);
|