1
1
/* eslint-disable @typescript-eslint/no-var-requires */
2
2
import { Model } from 'objection'
3
3
4
- export class ToysHouse extends Model {
4
+ export class ToyHouse extends Model {
5
+ toyId : number
6
+ houseId : number
7
+ amount : number
8
+
5
9
static get tableName ( ) {
6
- return 'toysHouse '
10
+ return 'toyHouse '
7
11
}
8
12
9
13
static get idColumn ( ) {
10
- return [ 'toys_id ' , 'house_id' ]
14
+ return [ 'toy_id ' , 'house_id' ]
11
15
}
12
16
13
17
static get jsonSchema ( ) {
@@ -16,31 +20,31 @@ export class ToysHouse extends Model {
16
20
required : [ 'name' ] ,
17
21
18
22
properties : {
19
- toys_id : { type : 'integer' } ,
20
- house_id : { type : 'integer' } ,
23
+ toyId : { type : 'integer' } ,
24
+ houseId : { type : 'integer' } ,
21
25
amount : { type : 'integer' } ,
22
26
} ,
23
27
}
24
28
}
25
29
26
30
static get relationMappings ( ) {
27
- const { Toys } = require ( './Toys ' )
31
+ const { Toy } = require ( './Toy ' )
28
32
const { House } = require ( './House' )
29
33
30
34
return {
31
35
toys : {
32
36
relation : Model . BelongsToOneRelation ,
33
- modelClass : Toys ,
37
+ modelClass : Toy ,
34
38
join : {
35
- from : 'toysHouse.toys_id ' ,
36
- to : 'toys .id' ,
39
+ from : 'toyHouse.toyId ' ,
40
+ to : 'toy .id' ,
37
41
} ,
38
42
} ,
39
43
house : {
40
44
relation : Model . BelongsToOneRelation ,
41
45
modelClass : House ,
42
46
join : {
43
- from : 'toysHouse.house_id ' ,
47
+ from : 'toyHouse.houseId ' ,
44
48
to : 'house.id' ,
45
49
} ,
46
50
} ,
0 commit comments