Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@authorize([PermissionKey.UpdateRole])
@put('/roles/{id}', {
responses: {
'204': {
description: 'Role PUT success',
},
},
})
async replaceById(
@param.path.number('id') id: number,
@requestBody() role: Role,
): Promise {
await this.roleRepository.replaceById(id, role);
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.DeleteRole])
@del('/roles/{id}', {
responses: {
'204': {
description: 'Role DELETE success',
},
},
})
async deleteById(@param.path.number('id') id: number): Promise {
await this.roleRepository.deleteById(id);
}
}
])
@put('/users/{id}', {
responses: {
'204': {
description: 'User PUT success',
},
},
})
async replaceById(
@param.path.number('id') id: number,
@requestBody() user: User,
): Promise {
await this.userRepository.replaceById(id, user);
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.DeleteAnyUser, PermissionKey.DeleteTenantUser])
@del('/users/{id}', {
responses: {
'204': {
description: 'User DELETE success',
},
},
})
async deleteById(@param.path.number('id') id: number): Promise {
await this.userRepository.deleteById(id);
}
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.ViewAudit])
@get('/audit-logs/{id}', {
responses: {
'200': {
description: 'AuditLog model instance',
content: {'application/json': {schema: {'x-ts-type': AuditLog}}},
},
},
})
async findById(@param.path.number('id') id: number): Promise {
return await this.auditLogRepository.findById(id);
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.UpdateAudit])
@patch('/audit-logs/{id}', {
responses: {
'204': {
description: 'AuditLog PATCH success',
},
},
})
async updateById(
@param.path.number('id') id: number,
@requestBody() auditLog: AuditLog,
): Promise {
await this.auditLogRepository.updateById(id, auditLog);
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.UpdateTenant])
@patch('/tenants/{id}', {
responses: {
'204': {
description: 'Tenant PATCH success',
},
},
})
async updateById(
@param.path.number('id') id: number,
@requestBody() tenant: Tenant,
): Promise {
await this.tenantRepository.updateById(id, tenant);
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.UpdateTenant])
@put('/tenants/{id}', {
responses: {
'204': {
description: 'Tenant PUT success',
},
},
})
async replaceById(
@param.path.number('id') id: number,
@requestBody() tenant: Tenant,
): Promise {
await this.tenantRepository.replaceById(id, tenant);
}
@authenticate(STRATEGY.BEARER)
content: {
'application/json': {
schema: {type: 'array', items: {'x-ts-type': AuditLog}},
},
},
},
},
})
async find(
@param.query.object('filter', getFilterSchemaFor(AuditLog))
filter?: Filter,
): Promise {
return await this.auditLogRepository.find(filter);
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.UpdateAudit])
@patch('/audit-logs', {
responses: {
'200': {
description: 'AuditLog PATCH success count',
content: {'application/json': {schema: CountSchema}},
},
},
})
async updateAll(
@requestBody() auditLog: AuditLog,
@param.query.object('where', getWhereSchemaFor(AuditLog))
where?: Where,
): Promise {
return await this.auditLogRepository.updateAll(auditLog, where);
}
@authorize([PermissionKey.UpdateAudit])
@patch('/audit-logs/{id}', {
responses: {
'204': {
description: 'AuditLog PATCH success',
},
},
})
async updateById(
@param.path.number('id') id: number,
@requestBody() auditLog: AuditLog,
): Promise {
await this.auditLogRepository.updateById(id, auditLog);
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.UpdateAudit])
@put('/audit-logs/{id}', {
responses: {
'204': {
description: 'AuditLog PUT success',
},
},
})
async replaceById(
@param.path.number('id') id: number,
@requestBody() auditLog: AuditLog,
): Promise {
await this.auditLogRepository.replaceById(id, auditLog);
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.UpdateTenant])
@put('/tenants/{id}', {
responses: {
'204': {
description: 'Tenant PUT success',
},
},
})
async replaceById(
@param.path.number('id') id: number,
@requestBody() tenant: Tenant,
): Promise {
await this.tenantRepository.replaceById(id, tenant);
}
@authenticate(STRATEGY.BEARER)
@authorize([PermissionKey.DeleteTenant])
@del('/tenants/{id}', {
responses: {
'204': {
description: 'Tenant DELETE success',
},
},
})
async deleteById(@param.path.number('id') id: number): Promise {
await this.tenantRepository.deleteById(id);
}
}
PermissionKey.ViewOwnUser,
PermissionKey.ViewTenantUser,
])
@get('/users/{id}', {
responses: {
'200': {
description: 'User model instance',
content: {'application/json': {schema: {'x-ts-type': User}}},
},
},
})
async findById(@param.path.number('id') id: number): Promise {
return await this.userRepository.findById(id);
}
@authenticate(STRATEGY.BEARER)
@authorize([
PermissionKey.UpdateAnyUser,
PermissionKey.UpdateOwnUser,
PermissionKey.UpdateTenantUser,
])
@patch('/users/{id}', {
responses: {
'204': {
description: 'User PATCH success',
},
},
})
async updateById(
@param.path.number('id') id: number,
@requestBody() user: User,
): Promise {