chore: Rename credentials as connections
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import Base from './base'
|
||||
import User from './user'
|
||||
|
||||
class Credential extends Base {
|
||||
class Connection extends Base {
|
||||
id!: number
|
||||
key!: string
|
||||
data!: any
|
||||
userId!: number
|
||||
verified: boolean
|
||||
|
||||
static tableName = 'credentials';
|
||||
static tableName = 'connections';
|
||||
|
||||
static jsonSchema = {
|
||||
type: 'object',
|
||||
@@ -24,15 +24,15 @@ class Credential extends Base {
|
||||
}
|
||||
|
||||
static relationMappings = () => ({
|
||||
credentials: {
|
||||
user: {
|
||||
relation: Base.BelongsToOneRelation,
|
||||
modelClass: User,
|
||||
join: {
|
||||
from: 'credentials.user_id',
|
||||
from: 'connections.user_id',
|
||||
to: 'users.id',
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default Credential;
|
||||
export default Connection;
|
@@ -1,6 +1,6 @@
|
||||
import { QueryContext, ModelOptions } from 'objection';
|
||||
import Base from './base';
|
||||
import Credential from './credential';
|
||||
import Connection from './connection';
|
||||
import bcrypt from 'bcrypt';
|
||||
|
||||
class User extends Base {
|
||||
@@ -22,12 +22,12 @@ class User extends Base {
|
||||
}
|
||||
|
||||
static relationMappings = () => ({
|
||||
credentials: {
|
||||
connections: {
|
||||
relation: Base.HasManyRelation,
|
||||
modelClass: Credential,
|
||||
modelClass: Connection,
|
||||
join: {
|
||||
from: 'users.id',
|
||||
to: 'credentials.user_id',
|
||||
to: 'connections.user_id',
|
||||
},
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user