WIP - BFF
This commit is contained in:
@@ -7,7 +7,7 @@ export class PageLayoutService {
|
||||
constructor(private tenantDbService: TenantDatabaseService) {}
|
||||
|
||||
async create(tenantId: string, createDto: CreatePageLayoutDto) {
|
||||
const knex = await this.tenantDbService.getTenantKnex(tenantId);
|
||||
const knex = await this.tenantDbService.getTenantKnexById(tenantId);
|
||||
const layoutType = createDto.layoutType || 'detail';
|
||||
|
||||
// If this layout is set as default, unset other defaults for the same object and layout type
|
||||
@@ -32,7 +32,7 @@ export class PageLayoutService {
|
||||
}
|
||||
|
||||
async findAll(tenantId: string, objectId?: string, layoutType?: PageLayoutType) {
|
||||
const knex = await this.tenantDbService.getTenantKnex(tenantId);
|
||||
const knex = await this.tenantDbService.getTenantKnexById(tenantId);
|
||||
|
||||
let query = knex('page_layouts');
|
||||
|
||||
@@ -49,7 +49,7 @@ export class PageLayoutService {
|
||||
}
|
||||
|
||||
async findOne(tenantId: string, id: string) {
|
||||
const knex = await this.tenantDbService.getTenantKnex(tenantId);
|
||||
const knex = await this.tenantDbService.getTenantKnexById(tenantId);
|
||||
|
||||
const layout = await knex('page_layouts').where({ id }).first();
|
||||
|
||||
@@ -61,7 +61,7 @@ export class PageLayoutService {
|
||||
}
|
||||
|
||||
async findDefaultByObject(tenantId: string, objectId: string, layoutType: PageLayoutType = 'detail') {
|
||||
const knex = await this.tenantDbService.getTenantKnex(tenantId);
|
||||
const knex = await this.tenantDbService.getTenantKnexById(tenantId);
|
||||
|
||||
const layout = await knex('page_layouts')
|
||||
.where({ object_id: objectId, is_default: true, layout_type: layoutType })
|
||||
@@ -71,7 +71,7 @@ export class PageLayoutService {
|
||||
}
|
||||
|
||||
async update(tenantId: string, id: string, updateDto: UpdatePageLayoutDto) {
|
||||
const knex = await this.tenantDbService.getTenantKnex(tenantId);
|
||||
const knex = await this.tenantDbService.getTenantKnexById(tenantId);
|
||||
|
||||
// Check if layout exists
|
||||
const layout = await this.findOne(tenantId, id);
|
||||
@@ -112,7 +112,7 @@ export class PageLayoutService {
|
||||
}
|
||||
|
||||
async remove(tenantId: string, id: string) {
|
||||
const knex = await this.tenantDbService.getTenantKnex(tenantId);
|
||||
const knex = await this.tenantDbService.getTenantKnexById(tenantId);
|
||||
|
||||
await this.findOne(tenantId, id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user