릴리스: v1.3.6 레거시 이미지 메타 백필 스크립트 추가
This commit is contained in:
@@ -223,6 +223,14 @@ async function query(sql, params = []) {
|
||||
return rows
|
||||
}
|
||||
|
||||
async function closePool() {
|
||||
if (!poolPromise) return
|
||||
const pool = await poolPromise
|
||||
await pool.end()
|
||||
poolPromise = null
|
||||
initPromise = null
|
||||
}
|
||||
|
||||
async function ensureSchema() {
|
||||
if (initPromise) return initPromise
|
||||
initPromise = (async () => {
|
||||
@@ -618,6 +626,14 @@ async function findImageAssetByHash(contentHash) {
|
||||
return mapImageAssetRow(rows[0])
|
||||
}
|
||||
|
||||
async function findImageAssetBySrc(src) {
|
||||
const rows = await query(
|
||||
'SELECT id, content_hash, src, mime_type, byte_size, original_byte_size, width, height, created_at FROM image_assets WHERE src = ? LIMIT 1',
|
||||
[src]
|
||||
)
|
||||
return mapImageAssetRow(rows[0])
|
||||
}
|
||||
|
||||
async function createImageAsset({ id, contentHash, src, mimeType = "image/webp", byteSize, originalByteSize, width, height }) {
|
||||
const createdAt = now()
|
||||
await query(
|
||||
@@ -1746,6 +1762,7 @@ async function unfavoriteGame({ userId, gameId }) {
|
||||
module.exports = {
|
||||
DB_NAME,
|
||||
ensureData,
|
||||
closePool,
|
||||
countUsers,
|
||||
findUserByEmail,
|
||||
findUserById,
|
||||
@@ -1762,6 +1779,7 @@ module.exports = {
|
||||
createGame,
|
||||
updateGameThumbnail,
|
||||
findImageAssetByHash,
|
||||
findImageAssetBySrc,
|
||||
createImageAsset,
|
||||
createImageOptimizationJob,
|
||||
findImageOptimizationJobById,
|
||||
|
||||
Reference in New Issue
Block a user