fix(rfid): existing tags were trying to be inserted and instead of updating failed corrected
This commit is contained in:
@@ -29,7 +29,14 @@ export const tagStuff = async (tagData: TagData[]): Promise<any> => {
|
||||
};
|
||||
try {
|
||||
// insert the tag with the onConflict update the tag
|
||||
const tag = await db.insert(rfidTags).values(newTag).returning({
|
||||
const tag = await db
|
||||
.insert(rfidTags)
|
||||
.values(newTag)
|
||||
.onConflictDoUpdate({
|
||||
target: rfidTags.tagHex,
|
||||
set: newTag,
|
||||
})
|
||||
.returning({
|
||||
tag: rfidTags.tag,
|
||||
runningNumber: rfidTags.runningNumber,
|
||||
counts: rfidTags.counts,
|
||||
|
||||
Reference in New Issue
Block a user