mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
IT WORKS NOW :))))))) (The send groq api key part)
This commit is contained in:
parent
e2b4acb68b
commit
2ef4cd9277
2 changed files with 9 additions and 4 deletions
|
@ -45,7 +45,7 @@ export default defineEventHandler(async (event) => {
|
||||||
error: "CANNOT_CREATE_NEW_USER",
|
error: "CANNOT_CREATE_NEW_USER",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const createOtherFields = await sql`
|
await sql`
|
||||||
insert into user_other_data(user_id, username, translate_enabled, translate_provider, remove_translate_popup, starred_news)
|
insert into user_other_data(user_id, username, translate_enabled, translate_provider, remove_translate_popup, starred_news)
|
||||||
values (${userUUID}, ${username}, false, 'google', false, '{}'::JSON)
|
values (${userUUID}, ${username}, false, 'google', false, '{}'::JSON)
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -32,9 +32,13 @@ export default defineEventHandler(async (event) => {
|
||||||
if (!allowedColumns.includes(requestChange)) {
|
if (!allowedColumns.includes(requestChange)) {
|
||||||
throw new Error("Invalid column name provided");
|
throw new Error("Invalid column name provided");
|
||||||
}
|
}
|
||||||
const sqlC = await sql.unsafe`
|
|
||||||
UPDATE user_other_data SET ${requestChange} = ${apiKeyqq[0]}
|
const sqlC = await sql.unsafe(
|
||||||
WHERE username = ${checkUserToken[0].username}`;
|
`
|
||||||
|
UPDATE user_other_data SET ${requestChange} = $1
|
||||||
|
WHERE username = $2`,
|
||||||
|
[apiKeyqq[0], checkUserToken[0].username],
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* // Example of how requestChange might be validated
|
* // Example of how requestChange might be validated
|
||||||
|
@ -52,6 +56,7 @@ export default defineEventHandler(async (event) => {
|
||||||
body: body,
|
body: body,
|
||||||
allowed: allowed,
|
allowed: allowed,
|
||||||
data: body.value.match(clearBadDataRegex),
|
data: body.value.match(clearBadDataRegex),
|
||||||
|
sqlC: sqlC,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue