Skip to content

Commit 42ee747

Browse files
committed
WIP fix schemas tickets
1 parent 0e69e32 commit 42ee747

File tree

20 files changed

+144
-67
lines changed

20 files changed

+144
-67
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
2+
import { Document, Types } from 'mongoose'
3+
import { SourceRequest } from '~/tickets/source-request/_schemas/source-request.schema'
4+
import { IdnamePart } from '~/_common/schemas/parts/idname.part.schema'
5+
6+
@Schema({ _id: false })
7+
export class IdfsPart extends IdnamePart {
8+
@Prop({
9+
type: String,
10+
required: true,
11+
})
12+
public namespace: string
13+
14+
@Prop({
15+
type: String,
16+
required: true,
17+
})
18+
public path: string
19+
20+
@Prop({
21+
type: String,
22+
})
23+
public mime: string
24+
}
25+
26+
export const IdfsPartSchema = SchemaFactory.createForClass(IdfsPart)

service/src/_common/schemas/parts/idname.part.schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
22
import { Document, Types } from 'mongoose'
3+
import { SourceRequest } from '~/tickets/source-request/_schemas/source-request.schema'
34

45
@Schema({ _id: false })
56
export class IdnamePart extends Document {

service/src/core/entities/_schemas/parts/phone.part.schema.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
2-
import { Document } from 'mongoose'
2+
import { Document, Types } from 'mongoose'
33
import { EntityState, EntityStateList } from '~/core/entities/_enum/entity-state.enum'
44
import { ProfilePart } from '~/core/entities/_schemas/parts/profile.part.schema'
55
import { PhoneType, PhoneTypeList } from '~/core/entities/_enum/phone-type.enum'
66

77
@Schema({ _id: false })
88
export class PhonePart extends Document {
9+
@Prop({
10+
type: Types.ObjectId,
11+
required: true,
12+
})
13+
public id: Types.ObjectId
14+
915
@Prop({
1016
type: Number,
1117
enum: PhoneTypeList,

service/src/core/filestorage/_schemas/filestorage.schema.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ export class Filestorage extends AbstractSchema {
1414
})
1515
public type: FsType
1616

17+
// text/html, application/pdf
18+
@Prop({
19+
type: String,
20+
})
21+
public mime?: string
22+
1723
@Prop({
1824
required: true,
1925
type: String,

service/src/core/projects/_schemas/project.schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { AbstractSchema } from '~/_common/abstracts/schemas/abstract.schema'
77
})
88
export class Project extends AbstractSchema {
99
@Prop({
10-
required: true,
1110
type: String,
11+
required: true,
12+
unique: true,
1213
})
1314
public name: string
1415

service/src/core/triggers/_schemas/triggers.schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import { AbstractSchema } from '~/_common/abstracts/schemas/abstract.schema'
88
})
99
export class Triggers extends AbstractSchema {
1010
@Prop({
11-
required: true,
1211
type: String,
12+
required: true,
13+
unique: true,
1314
})
1415
public name: string
1516

service/src/tickets/sla/_schemas/sla.schema.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,24 @@ export class Sla extends AbstractSchema {
1010
@Prop({
1111
type: String,
1212
required: true,
13+
unique: true,
1314
})
1415
public name: string
1516

1617
@Prop({
1718
type: String,
18-
required: true,
1919
})
2020
public description: string
2121

2222
@Prop({
2323
type: String,
24-
required: true,
2524
})
26-
public icon: string
25+
public icon?: string
2726

2827
@Prop({
2928
type: String,
30-
required: true,
3129
})
32-
public color: string
30+
public color?: string
3331

3432
@Prop({
3533
type: [RulePartSchema],
@@ -39,13 +37,12 @@ export class Sla extends AbstractSchema {
3937

4038
@Prop({
4139
type: String,
42-
required: true,
4340
})
44-
public backgroundColor: string
41+
public backgroundColor?: string
4542

4643
@Prop({
4744
type: Number,
48-
required: true,
45+
default: 0,
4946
})
5047
public order: number
5148

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import { AbstractController } from '~/_common/abstracts/abstract.controller'
44
import { Request, Response } from 'express'
55
import { SlaCreateDto, SlaUpdateDto } from '~/tickets/sla/_dto/sla.dto'
66
import { FilterOptions, FilterSchema, SearchFilterOptions, SearchFilterSchema } from '@streamkits/nestjs_module_scrud'
7-
import { ApiParam } from '@nestjs/swagger'
7+
import { ApiParam, ApiTags } from '@nestjs/swagger'
88
import { ObjectIdValidationPipe } from '~/_common/pipes/object-id-validation.pipe'
99
import { Types } from 'mongoose'
1010

11+
@ApiTags('tickets')
1112
@Controller('sla')
1213
export class SlaController extends AbstractController {
1314
protected readonly projection = {

service/src/tickets/source-request/_schemas/source-request.schema.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,24 @@ export class SourceRequest extends AbstractSchema {
1010
@Prop({
1111
type: String,
1212
required: true,
13+
unique: true,
1314
})
1415
public name: string
1516

1617
@Prop({
1718
type: String,
18-
required: true,
1919
})
2020
public description: string
2121

2222
@Prop({
2323
type: String,
24-
required: true,
2524
})
26-
public icon: string
25+
public icon?: string
2726

2827
@Prop({
2928
type: String,
30-
required: true,
3129
})
32-
public color: string
30+
public color?: string
3331

3432
@Prop({
3533
type: [RulePartSchema],
@@ -39,13 +37,12 @@ export class SourceRequest extends AbstractSchema {
3937

4038
@Prop({
4139
type: String,
42-
required: true,
4340
})
44-
public backgroundColor: string
41+
public backgroundColor?: string
4542

4643
@Prop({
4744
type: Number,
48-
required: true,
45+
default: 0,
4946
})
5047
public order: number
5148

service/src/tickets/source-request/source-request.controller.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { Body, Controller, Delete, Get, HttpStatus, Param, Patch, Post, Req, Res } from '@nestjs/common'
22
import { AbstractController } from '~/_common/abstracts/abstract.controller'
33
import { Request, Response } from 'express'
4-
import { FilterOptions, SearchFilterOptions, FilterSchema, SearchFilterSchema } from '@streamkits/nestjs_module_scrud'
5-
import { ApiParam } from '@nestjs/swagger'
4+
import { FilterOptions, FilterSchema, SearchFilterOptions, SearchFilterSchema } from '@streamkits/nestjs_module_scrud'
5+
import { ApiParam, ApiTags } from '@nestjs/swagger'
66
import { ObjectIdValidationPipe } from '~/_common/pipes/object-id-validation.pipe'
77
import { Types } from 'mongoose'
88
import { SourceRequestCreateDto, SourceRequestUpdateDto } from '~/tickets/source-request/_dto/source-request.dto'
99
import { SourceRequestService } from '~/tickets/source-request/source-request.service'
1010

11+
@ApiTags('tickets')
1112
@Controller('source-request')
1213
export class SourceRequestController extends AbstractController {
1314
protected readonly projection = {

0 commit comments

Comments
 (0)