summaryrefslogtreecommitdiff
path: root/src/models/transfer/transfer.schema.ts
blob: 5a4240aa8c05267247211e314ce64ea33769411e (plain)
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
34
import { Document, Schema, Types } from 'mongoose';

export interface TransferSchema extends Document {
  date: string;
  operation: 'in' | 'out';
  accountId: string;
  contractorId: string;
  amount: number;
}


export const transferSchema = new Schema({
  date: {
    type: Date,
    required: true,
  },
  operation: {
    type: String,
    required: true,
  },
  accountId: {
    type: Types.ObjectId,
    required: true,
  },
  contractorId: {
    type: Types.ObjectId,
    required: true,
  },
  amount: {
    type: Number,
    required: true,
  },
}, { timestamps: true });