This commit is contained in:
seb
2026-08-01 01:36:49 +02:00
parent 243143e7eb
commit 671064bf3f
9 changed files with 181 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
import { GET_CATEGORY_ID_BY_HASH } from '../../sql/pic.js';
import resolveCategoryAccess from '../category/resolveCategoryAccess.js';
export default function resolvePicAccess(pool) {
const access = resolveCategoryAccess(pool);
return async (googleAuthId, hash) => {
const result = await pool
.request()
.input('hash', hash)
.query(GET_CATEGORY_ID_BY_HASH);
const categoryId = result.recordset[0]?.categoryId;
if (!categoryId) {
throw new Error('Image not found');
}
await access(googleAuthId, categoryId);
};
}