Fix dropdown values saving, add back checkbox column, mostly fix validation, fix some field types
This commit is contained in:
@@ -742,7 +742,7 @@ router.post("/validate", async (req, res) => {
|
||||
|
||||
console.log("🤖 Sending request to OpenAI...");
|
||||
const completion = await openai.chat.completions.create({
|
||||
model: "gpt-4o",
|
||||
model: "o3-mini",
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
|
||||
@@ -924,16 +924,16 @@ router.get('/check-upc-and-generate-sku', async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
// Step 2: Generate item number - supplierId-last6DigitsOfUPC minus last digit
|
||||
// Step 2: Generate item number - supplierId-last5DigitsOfUPC minus last digit
|
||||
let itemNumber = '';
|
||||
const upcStr = String(upc);
|
||||
|
||||
// Extract the last 6 digits of the UPC, removing the last digit (checksum)
|
||||
// So we get 5 digits from positions: length-7 to length-2
|
||||
if (upcStr.length >= 7) {
|
||||
const lastSixMinusOne = upcStr.substring(upcStr.length - 7, upcStr.length - 1);
|
||||
itemNumber = `${supplierId}-${lastSixMinusOne}`;
|
||||
} else if (upcStr.length >= 6) {
|
||||
// Extract the last 5 digits of the UPC, removing the last digit (checksum)
|
||||
// So we get 5 digits from positions: length-6 to length-2
|
||||
if (upcStr.length >= 6) {
|
||||
const lastFiveMinusOne = upcStr.substring(upcStr.length - 6, upcStr.length - 1);
|
||||
itemNumber = `${supplierId}-${lastFiveMinusOne}`;
|
||||
} else if (upcStr.length >= 5) {
|
||||
// If UPC is shorter, use as many digits as possible
|
||||
const digitsToUse = upcStr.substring(0, upcStr.length - 1);
|
||||
itemNumber = `${supplierId}-${digitsToUse}`;
|
||||
|
||||
Reference in New Issue
Block a user