summaryrefslogtreecommitdiff
path: root/src/models/account/account.schema.ts
blob: 732ccc7289283a8c4121e77e4a8f87771202f148 (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
import { Document, Schema } from 'mongoose';

export interface AccountSchema extends Document {
  name: string;
  code: string;
  balance: number;
  currency: 'BYN' | 'USD' | 'EUR';
}

export const accountSchema = new Schema({
  name: {
    type: String,
    required: true,
  },
  code: {
    type: String,
    required: true,
  },
  balance: {
    type: Number,
    default: 0,
  },
  currency: {
    type: String,
    default: 'BYN'
  },
}, { timestamps: true });