Skip to content

Commit

Permalink
Updated search pipeline for schema
Browse files Browse the repository at this point in the history
  • Loading branch information
kiran-rean committed Dec 20, 2024
1 parent 4a609b6 commit 130e3dd
Showing 3 changed files with 49 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -27,7 +27,10 @@ body:json {
"EventTimestamp": "{{TIMESTAMP}}",
"MessageType": "Text",
"MessageChannel": "WhatsApp",
"TextMessage": "Help..."
"TextMessage": "Help...",
"Payload": {
"SchemaId": "{{SCHEMA_ID}}"
}
}
}
}
36 changes: 36 additions & 0 deletions bruno/Workflow service/Unused/Search schema by Tenant Id.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
meta {
name: Search schema by Tenant Id
type: http
seq: 3
}

get {
url: {{BASE_URL}}/engine/schema/search?tenantId={{TENANT_ID}}
body: none
auth: none
}

params:query {
tenantId: {{TENANT_ID}}
}

headers {
Content-Type: application/json
x-api-key: {{API_KEY}}
Authorization: Bearer {{MODERATOR_USER_JWT}}
}

tests {
test("Request is successfull", function () {
expect(res.getStatus()).to.equal(200);
var jsonRes = res.getBody();
expect(jsonRes.Status).to.eql('success');
});

}

docs {
User login with username/phone/email and password.

'LoginRoleId' is the role id through which user wants to log into the system provided the user has the role.
}
18 changes: 9 additions & 9 deletions src/api/base.validator.ts
Original file line number Diff line number Diff line change
@@ -42,15 +42,15 @@ export default class BaseValidator {

public validateBaseSearchFilters = async(request: express.Request) => {
try {
const schema = joi.object({
createdDateFrom : joi.date().optional(),
createdDateTo : joi.date().optional(),
orderBy : joi.string().optional(),
order : joi.string().allow('ascending', 'descending').optional(),
pageIndex : joi.number().integer().sign('positive').optional(),
itemsPerPage : joi.number().integer().sign('positive').optional(),
});
await schema.validateAsync(request.query);
// const schema = joi.object({
// createdDateFrom : joi.date().optional(),
// createdDateTo : joi.date().optional(),
// orderBy : joi.string().optional(),
// order : joi.string().allow('ascending', 'descending').optional(),
// pageIndex : joi.number().integer().sign('positive').optional(),
// itemsPerPage : joi.number().integer().sign('positive').optional(),
// });
// await schema.validateAsync(request.query);
return this.getBaseSearchFilters(request);
} catch (error) {
ErrorHandler.handleValidationError(error);

0 comments on commit 130e3dd

Please # to comment.