1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 });
|