Skip to content

Commit 5710b9e

Browse files
committed
WIP source request schema
1 parent bb844fd commit 5710b9e

File tree

2 files changed

+59
-5
lines changed

2 files changed

+59
-5
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: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,58 @@
1-
import { Schema, SchemaFactory } from '@nestjs/mongoose'
2-
import { Document } from 'mongoose'
1+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
32
import { AbstractSchema } from '~/_common/abstracts/schemas/abstract.schema'
4-
5-
export type SourceRequestDocument = SourceRequest & Document
3+
import { RulePart, RulePartSchema } from '~/tickets/source-request/_schemas/parts/rules.part.schema'
64

75
@Schema({
86
collection: 'source-requests',
97
versionKey: false,
108
})
11-
export class SourceRequest extends AbstractSchema {}
9+
export class SourceRequest 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
56+
}
1257

1358
export const SourceRequestSchema = SchemaFactory.createForClass(SourceRequest)

0 commit comments

Comments
 (0)