Skip to content

Conversation

@BboyStatix
Copy link
Contributor

@BboyStatix BboyStatix commented Jul 29, 2021

Ticket Link

https://jira.crossroads.org.hk/browse/GCW-3681

What does this PR do?

Creates an atomic upsert query to prevent race conditions.

@BboyStatix BboyStatix self-assigned this Jul 29, 2021
@BboyStatix BboyStatix requested review from patrixr and steveyken July 29, 2021 10:12
): Promise<ReadReceipt|null> {
const result = await sql`
insert into "ReadReceipt" ("userId", "userType", "conversationId", "lastReadMessageId", "updatedAt")
select ${staffId}, ${authorType}, ${conversationId}, "Message"."id", now()
Copy link
Member

Choose a reason for hiding this comment

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

are we safe from SQL injection? Otherwise all good to go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants