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