Skip to content

Commit

Permalink
Merge pull request #160 from Xitija/sdbv_rbac_changes
Browse files Browse the repository at this point in the history
Added api obj in forms
  • Loading branch information
Shubham4026 authored Feb 21, 2025
2 parents 2685832 + 0f0d014 commit 06f585c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/forms/forms.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class FormsService {
private readonly fieldsService: PostgresFieldsService,
@InjectRepository(Form)
private readonly formRepository: Repository<Form>
) {}
) { }

async getForm(requiredData, response) {
let apiId = APIID.FORM_GET;
Expand All @@ -30,11 +30,11 @@ export class FormsService {
HttpStatus.BAD_REQUEST
);
}


const { context, contextType, tenantId } = requiredData;
const validationResult = await this.validateFormInput(requiredData);

if (validationResult.error) {
return APIResponse.error(
response,
Expand Down Expand Up @@ -74,7 +74,7 @@ export class FormsService {
whereClause
);
customFieldData.order = data.order;
return customFieldData;
return { ...data, ...customFieldData };
}
return data;
})
Expand Down Expand Up @@ -163,7 +163,7 @@ export class FormsService {

if (context) {
const validContextTypes = await this.getValidContextTypes(context);

if (validContextTypes.length === 0) {
return { error: `Invalid context: ${context}` };
}
Expand All @@ -180,7 +180,7 @@ export class FormsService {
}


private async getValidContextTypes(context: string): Promise<string[]> {
private async getValidContextTypes(context: string): Promise<string[]> {
switch (context.toLowerCase()) {
case "users":
return await this.getUserContextTypesFromDB();
Expand Down

0 comments on commit 06f585c

Please sign in to comment.