From 8b8d9dca565b24b0811d01fa8bc5b07996e66dad Mon Sep 17 00:00:00 2001 From: vplasencia Date: Thu, 30 Nov 2023 11:47:58 +0100 Subject: [PATCH 1/4] refactor(api): add dummy commit to redeploy --- apps/api/src/app/groups/groups.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/app/groups/groups.service.ts b/apps/api/src/app/groups/groups.service.ts index c36de814..bd4a8eba 100644 --- a/apps/api/src/app/groups/groups.service.ts +++ b/apps/api/src/app/groups/groups.service.ts @@ -42,7 +42,7 @@ export class GroupsService { } /** - * Initialises the service, caches groups and may sync contract + * Initialises the service, caches groups and may sync contrac * groups if required. */ async initialize() { From c7a64f5215701ab78ea48e751fc9e67e9408d2a0 Mon Sep 17 00:00:00 2001 From: vplasencia Date: Mon, 4 Dec 2023 10:56:37 +0100 Subject: [PATCH 2/4] refactor(api): test cached groups --- apps/api/src/app/groups/groups.controller.ts | 11 +++++++++++ apps/api/src/app/groups/groups.service.ts | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/api/src/app/groups/groups.controller.ts b/apps/api/src/app/groups/groups.controller.ts index cfd69d9a..3d205bcf 100644 --- a/apps/api/src/app/groups/groups.controller.ts +++ b/apps/api/src/app/groups/groups.controller.ts @@ -49,6 +49,17 @@ export class GroupsController { return groups.map((g) => mapGroupToResponseDTO(g)) } + @Get("/cachedgroups") + @ApiOperation({ description: "Returns the cached groups." }) + @ApiCreatedResponse() + async getCachedGroups() { + const groups = await this.groupsService.getCachedGroups() + + console.log("Controller", groups) + + return groups + } + @Get(":group") @ApiOperation({ description: "Returns a specific group." }) @ApiCreatedResponse({ type: Group }) diff --git a/apps/api/src/app/groups/groups.service.ts b/apps/api/src/app/groups/groups.service.ts index bd4a8eba..fdacb5aa 100644 --- a/apps/api/src/app/groups/groups.service.ts +++ b/apps/api/src/app/groups/groups.service.ts @@ -42,7 +42,7 @@ export class GroupsService { } /** - * Initialises the service, caches groups and may sync contrac + * Initialises the service, caches groups and may sync contract * groups if required. */ async initialize() { @@ -630,6 +630,12 @@ export class GroupsService { return group } + async getCachedGroups() { + console.log("Service", Array.from(this.cachedGroups.keys())) + + return Array.from(this.cachedGroups.keys()) + } + /** * Checks if a member belongs to a group. * @param groupId Group id. From 19f885404245da67934b7e7b6478633954823a4b Mon Sep 17 00:00:00 2001 From: vplasencia Date: Mon, 4 Dec 2023 14:18:40 +0100 Subject: [PATCH 3/4] refactor(api): update init cached groups function --- apps/api/src/app/groups/groups.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/app/groups/groups.service.ts b/apps/api/src/app/groups/groups.service.ts index fdacb5aa..597af69f 100644 --- a/apps/api/src/app/groups/groups.service.ts +++ b/apps/api/src/app/groups/groups.service.ts @@ -694,7 +694,7 @@ export class GroupsService { const cachedGroup = new CachedGroup( group.id, group.treeDepth, - group.members.map((m) => m.id) + group.members.map((m) => BigInt(m.id)) ) this.cachedGroups.set(group.id, cachedGroup) From bea4a1b3007903df52a094367ce326071aabd710 Mon Sep 17 00:00:00 2001 From: iwantanode <87604944+tudorpintea999@users.noreply.github.com> Date: Wed, 6 Dec 2023 06:38:53 +0200 Subject: [PATCH 4/4] minor typos README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 80bb4caa..3c6fc7a0 100644 --- a/README.md +++ b/README.md @@ -246,7 +246,7 @@ It will also automatically check that the modified files comply with ESLint and ### Database -Bandada requires a SQL database to work, which is used by the `api` application. +Bandada requires an SQL database to work, which is used by the `api` application. Bandada can work with Postgres and SQLite. Other SQL flavors should work but have not been tested yet. You can pass the connection URL to the database using the environment variable (see below). @@ -260,7 +260,7 @@ yarn test ### Running in Docker -You can also run Bandada using Docker by running below command in the project root: +You can also run Bandada using Docker by running the below command in the project root: ```sh docker-compose up -d