Skip to content

Commit 36c784d

Browse files
committed
WIP state schema
1 parent 5710b9e commit 36c784d

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Schema, SchemaFactory } from '@nestjs/mongoose'
2+
import { Document } from 'mongoose'
3+
4+
@Schema({ _id: false })
5+
export class RulePart extends Document {
6+
7+
}
8+
9+
export const RulePartSchema = SchemaFactory.createForClass(RulePart)
Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,58 @@
1-
import { Schema, SchemaFactory } from '@nestjs/mongoose'
1+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
22
import { AbstractSchema } from '~/_common/abstracts/schemas/abstract.schema'
3+
import { RulePart, RulePartSchema } from '~/tickets/state/_schemas/parts/rules.part.schema'
34

45
@Schema({
56
collection: 'states',
67
versionKey: false,
78
})
89
export class State extends AbstractSchema {
10+
@Prop({
11+
type: String,
12+
required: true,
13+
})
14+
public name: string
15+
16+
@Prop({
17+
type: String,
18+
required: true,
19+
})
20+
public description: string
21+
22+
@Prop({
23+
type: String,
24+
required: true,
25+
})
26+
public icon: string
27+
28+
@Prop({
29+
type: String,
30+
required: true,
31+
})
32+
public color: string
33+
34+
@Prop({
35+
type: [RulePartSchema],
36+
required: true,
37+
})
38+
public rules: RulePart[]
39+
40+
@Prop({
41+
type: String,
42+
required: true,
43+
})
44+
public backgroundColor: string
45+
46+
@Prop({
47+
type: Number,
48+
required: true,
49+
})
50+
public order: number
51+
52+
@Prop({
53+
type: Object,
54+
})
55+
public customFields: object
956
}
1057

1158
export const StateSchema = SchemaFactory.createForClass(State)

0 commit comments

Comments
 (0)