refactor: extract note model
This commit is contained in:
13
src/modules/note/models/coordinate.model.ts
Normal file
13
src/modules/note/models/coordinate.model.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { IsNumber } from 'class-validator'
|
||||
|
||||
import { modelOptions, prop } from '@typegoose/typegoose'
|
||||
|
||||
@modelOptions({ schemaOptions: { id: false, _id: false } })
|
||||
export class Coordinate {
|
||||
@IsNumber()
|
||||
@prop()
|
||||
latitude: number
|
||||
@prop()
|
||||
@IsNumber()
|
||||
longitude: number
|
||||
}
|
||||
21
src/modules/note/models/music.model.ts
Normal file
21
src/modules/note/models/music.model.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { IsNotEmpty, IsString } from 'class-validator'
|
||||
|
||||
import { modelOptions, prop } from '@typegoose/typegoose'
|
||||
|
||||
@modelOptions({
|
||||
schemaOptions: {
|
||||
id: false,
|
||||
_id: false,
|
||||
},
|
||||
})
|
||||
export class NoteMusic {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@prop({ required: true })
|
||||
type: string
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@prop({ required: true })
|
||||
id: string
|
||||
}
|
||||
Reference in New Issue
Block a user