feat: add shared connection capability

This commit is contained in:
Ali BARIN
2023-09-08 11:32:22 +00:00
parent aefff5c861
commit 099a8ea2cf
19 changed files with 315 additions and 103 deletions

View File

@@ -0,0 +1,45 @@
import Base from './base';
import Role from './role';
import User from './user';
class SharedConnection extends Base {
id!: string;
roleId!: string;
connectionId!: string;
static tableName = 'shared_connections';
static jsonSchema = {
type: 'object',
required: ['name', 'key'],
properties: {
id: { type: 'string', format: 'uuid' },
roleId: { type: 'string', format: 'uuid' },
connectionId: { type: 'string', format: 'uuid' },
createdAt: { type: 'string' },
updatedAt: { type: 'string' },
},
};
static relationMappings = () => ({
roles: {
relation: Base.HasManyRelation,
modelClass: Role,
join: {
from: 'shared_connections.role_id',
to: 'roles.id',
},
},
users: {
relation: Base.HasManyRelation,
modelClass: User,
join: {
from: 'shared_connections.role_id',
to: 'users.role_id',
},
},
});
}
export default SharedConnection;