diff options
author | eug-vs <eug-vs@keemail.me> | 2021-03-14 13:31:45 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2021-03-14 13:31:45 +0300 |
commit | 3a2cdd13b0374aab279b8dd819b03f82013cb026 (patch) | |
tree | ede046b9c7a0612379b6ac8395ca41f47f7bad5b /src/models/waybill/waybill.schema.ts | |
parent | ac9698ea0de17ab2d1fbfafead0f33295a402e28 (diff) | |
download | commercel-api-3a2cdd13b0374aab279b8dd819b03f82013cb026.tar.gz |
feat: add Waybills service
Diffstat (limited to 'src/models/waybill/waybill.schema.ts')
-rw-r--r-- | src/models/waybill/waybill.schema.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/models/waybill/waybill.schema.ts b/src/models/waybill/waybill.schema.ts new file mode 100644 index 0000000..ce14525 --- /dev/null +++ b/src/models/waybill/waybill.schema.ts @@ -0,0 +1,33 @@ +import { Document, Schema, Types } from 'mongoose'; + +export interface WaybillSchema extends Document { + operation: 'in' | 'out'; + productId: string; + quantity: number; + contractorId: string; + status: 'waiting' | 'executed' | 'cancelled'; +} + +export const waybillSchema = new Schema({ + operation: { + type: String, + required: true, + }, + contractorId: { + type: Types.ObjectId, + required: true, + }, + productId: { + type: Types.ObjectId, + required: true, + }, + quantity: { + type: Number, + min: 1, + }, + status: { + type: String, + default: 'waiting', + }, +}, { timestamps: true }); + |