Skip to content

Commit e213ff7

Browse files
committed
WIP sla schema
1 parent a36841a commit e213ff7

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
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: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,65 @@
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/sla/_schemas/parts/rules.part.schema'
34

4-
@Schema({ versionKey: false })
5+
@Schema({
6+
collection: 'sla',
7+
versionKey: false,
8+
})
59
export class Sla 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: Number,
54+
required: true,
55+
validate: (value: number) => value > 0,
56+
})
57+
public timeToExpire: number
58+
59+
@Prop({
60+
type: Object,
61+
})
62+
public customFields: object
663
}
764

865
export const SlaSchema = SchemaFactory.createForClass(Sla)

service/src/tickets/sla/sla.controller.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Body, Controller, Delete, Get, HttpStatus, Param, Patch, Post, Req, Res } from '@nestjs/common'
22
import { SlaService } from './sla.service'
33
import { AbstractController } from '~/_common/abstracts/abstract.controller'
4-
import { StateService } from '~/tickets/state/state.service'
54
import { Request, Response } from 'express'
65
import { SlaCreateDto, SlaUpdateDto } from '~/tickets/sla/_dto/sla.dto'
76
import { FilterOptions, FilterSchema, SearchFilterOptions, SearchFilterSchema } from '@streamkits/nestjs_module_scrud'

0 commit comments

Comments
 (0)