Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2484,8 +2484,8 @@ export class UserService {
const createdBy = String(Constants.DEFAULT_CREATE_USER_ID);
const membershipType = Constants.memberGroupMembershipName;
const affected = await this.groupPrismaClient.$executeRaw`
INSERT INTO "groups"."GroupMember" ("id", "groupId", "memberId", "membershipType", "createdBy")
VALUES (${groupMemberId}, ${groupId}, ${memberId}, ${membershipType}, ${createdBy})
INSERT INTO "groups"."GroupMember" ("id", "groupId", "memberId", "membershipType", "roles", "createdAt", "createdBy", "updatedAt", "updatedBy")
VALUES (${groupMemberId}, ${groupId}, ${memberId}, ${membershipType}, '{}', NOW(), ${createdBy}, NOW(), ${createdBy})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The roles column is being set to an empty JSON object ('{}'). If this is intended to be an array or a more complex JSON structure, consider using [] for an empty array or ensure the structure matches the expected schema to avoid potential issues with data handling later.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 design]
The use of NOW() for createdAt and updatedAt assumes that the database server's time is accurate and synchronized. Consider using a consistent time source or service if time accuracy is critical for your application.

ON CONFLICT ("groupId", "memberId") DO NOTHING
`;
if (affected === 0) {
Expand Down
Loading