Skip to content

Commit

Permalink
Remove duplicate validation in putSynonyms
Browse files Browse the repository at this point in the history
Also, perform the validation earlier to prevent unnecessary work.
  • Loading branch information
lpsinger committed Mar 1, 2024
1 parent cd28828 commit 2c2cd1a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/routes/_gcn.synonyms/synonyms.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,11 @@ export async function putSynonyms({
additions?: string[]
subtractions?: string[]
}) {
if (!subtractions?.length && !additions?.length) return
const db = await tables()
const client = db._doc as unknown as DynamoDBDocument
const TableName = db.name('synonyms')
const writes = []
if (!subtractions && !additions) return
if (subtractions?.length === 0 && additions?.length === 0) return
if (subtractions) {
const subtraction_writes = subtractions.map((eventId) => ({
DeleteRequest: {
Expand Down

0 comments on commit 2c2cd1a

Please sign in to comment.