Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Commit 2c44b6a

Browse files
✨ Add user details to membership
1 parent 2d74813 commit 2c44b6a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/crud/membership.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { User } from "../interfaces/tables/user";
1111
import { getOrganization } from "./organization";
1212
import { ErrorCode, CacheCategories } from "../interfaces/enum";
1313
import { deleteItemFromCache, cachedQuery } from "../helpers/cache";
14+
import { getUser } from "./user";
1415

1516
/*
1617
* Create a new organization membership for a user
@@ -117,7 +118,10 @@ export const getOrganizationMembers = async (organizationId: number) => {
117118
* Get a detailed list of all members in an organization
118119
*/
119120
export const getOrganizationMemberDetails = async (organizationId: number) => {
120-
const members = await getOrganizationMembers(organizationId);
121+
const members: any = await getOrganizationMembers(organizationId);
122+
for await (const member of members) {
123+
member.user = await getUser(member.userId);
124+
}
121125
return members;
122126
};
123127

src/routes/organizations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const routeOrganizationGet = async (req: Request, res: Response) => {
1212
res.locals.token.id,
1313
req.params.id
1414
);
15-
res.json({ organization });
15+
res.json(organization);
1616
};
1717

1818
export const routeOrganizationCreate = async (req: Request, res: Response) => {

0 commit comments

Comments
 (0)