Skip to content

Commit

Permalink
fix: binary -> hex format for column
Browse files Browse the repository at this point in the history
  • Loading branch information
rikumi committed Sep 25, 2024
1 parent a2517b7 commit 95aa527
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/database/sticker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const init = async () => {

export const setFavoriteSticker = async (userId: string, keyword: string, sticker: GenericMedia) => {
const db = await getDatabase();
const userKeywordHash = crypto.createHash('sha256').update(`${userId}:${keyword}`).digest();
const userKeywordHash = crypto.createHash('sha256').update(`${userId}:${keyword}`).digest('hex');
await db.run(`INSERT OR REPLACE INTO sticker_favorite (
user_id_keyword_hash,
url, mime_type, size,
Expand All @@ -30,7 +30,7 @@ export const setFavoriteSticker = async (userId: string, keyword: string, sticke

export const getFavoriteSticker = async (userId: string, keyword: string): Promise<GenericMedia | null> => {
const db = await getDatabase();
const userKeywordHash = crypto.createHash('sha256').update(`${userId}:${keyword}`).digest();
const userKeywordHash = crypto.createHash('sha256').update(`${userId}:${keyword}`).digest('hex');
const record = await db.get(`SELECT * FROM sticker_favorite WHERE user_id_keyword_hash = ?`, [userKeywordHash]);
if (!record) {
return null;
Expand Down

0 comments on commit 95aa527

Please sign in to comment.