You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
394 B
22 lines
394 B
1 year ago
|
import { Model } from 'objection'
|
||
|
import Point from './point.js'
|
||
|
|
||
|
class MapModel extends Model {
|
||
|
static tableName = 'maps'
|
||
|
|
||
|
static get relationMappings() {
|
||
|
return {
|
||
|
map_points: {
|
||
|
relation: Model.HasManyRelation,
|
||
|
modelClass: Point,
|
||
|
join: {
|
||
|
from: 'maps.id',
|
||
|
to: 'map_points.map_id',
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default MapModel
|