Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[recnet-api] Follow the person who invites the user #357

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
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
10 changes: 9 additions & 1 deletion apps/recnet-api/src/database/repository/user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,22 @@ export default class UserRepository {
select: user.select,
});

await prisma.inviteCode.update({
const inviteCode = await prisma.inviteCode.update({
where: { code: createUserInput.inviteCode },
data: {
usedById: userInTransaction.id,
usedAt: new Date(),
},
});

// follow the person who gave the invite code
await this.prisma.followingRecord.create({
swh00tw marked this conversation as resolved.
Show resolved Hide resolved
data: {
followedById: userInTransaction.id,
followingId: inviteCode.ownerId,
},
});

return userInTransaction;
});
}
Expand Down
Loading