mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-07 14:28:13 -04:00

the #shared alias used by Nuxt cannot be easily disabled and to prevent breackage with jiti, we make use of it
13 lines
443 B
TypeScript
13 lines
443 B
TypeScript
import SQL from 'sql-template-strings';
|
|
|
|
import type { User } from '#shared/user.ts';
|
|
import type { Database } from '~~/server/db.ts';
|
|
|
|
export const isAllowedToPost = async (db: Database, user: User | null): Promise<boolean> => {
|
|
if (!user) {
|
|
return false;
|
|
}
|
|
const dbUser = await db.get<Pick<User, 'bannedReason'>>(SQL`SELECT bannedReason FROM users WHERE id = ${user.id}`);
|
|
return !!dbUser && !dbUser.bannedReason;
|
|
};
|