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.
34 lines
820 B
34 lines
820 B
const { Model } = require("objection"); |
|
const Knex = require("knex"); |
|
const knexConfig = require("../knexfile"); |
|
|
|
class Redirect extends Model { |
|
static get tableName() { |
|
return "redirects"; |
|
} |
|
|
|
static get jsonSchema() { |
|
return { |
|
type: "object", |
|
required: ["forward_to", "alias"], |
|
properties: { |
|
id: { type: "integer" }, |
|
forwardTo: { type: "string" }, |
|
alias: { type: "string" }, |
|
}, |
|
}; |
|
} |
|
|
|
static get relationMappings() { |
|
return { |
|
user: { |
|
relation: Model.BelongsToOneRelation, |
|
modelClass: "User", |
|
from: "redirects.user_id", |
|
to: "user.id", |
|
}, |
|
}; |
|
} |
|
} |
|
|
|
module.exports = Redirect;
|
|
|