Skip to content

Commit c7a64f5

Browse files
committed
refactor(api): test cached groups
1 parent 8b8d9dc commit c7a64f5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

apps/api/src/app/groups/groups.controller.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ export class GroupsController {
4949
return groups.map((g) => mapGroupToResponseDTO(g))
5050
}
5151

52+
@Get("/cachedgroups")
53+
@ApiOperation({ description: "Returns the cached groups." })
54+
@ApiCreatedResponse()
55+
async getCachedGroups() {
56+
const groups = await this.groupsService.getCachedGroups()
57+
58+
console.log("Controller", groups)
59+
60+
return groups
61+
}
62+
5263
@Get(":group")
5364
@ApiOperation({ description: "Returns a specific group." })
5465
@ApiCreatedResponse({ type: Group })

apps/api/src/app/groups/groups.service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class GroupsService {
4242
}
4343

4444
/**
45-
* Initialises the service, caches groups and may sync contrac
45+
* Initialises the service, caches groups and may sync contract
4646
* groups if required.
4747
*/
4848
async initialize() {
@@ -630,6 +630,12 @@ export class GroupsService {
630630
return group
631631
}
632632

633+
async getCachedGroups() {
634+
console.log("Service", Array.from(this.cachedGroups.keys()))
635+
636+
return Array.from(this.cachedGroups.keys())
637+
}
638+
633639
/**
634640
* Checks if a member belongs to a group.
635641
* @param groupId Group id.

0 commit comments

Comments
 (0)