resolve issues with new features

This commit is contained in:
Matthias Hochmeister
2026-03-12 16:05:01 +01:00
parent a5cd78f01f
commit 5aa309b97a
22 changed files with 796 additions and 234 deletions

View File

@@ -4,6 +4,7 @@ export interface Banner {
id: string;
message: string;
level: 'info' | 'important' | 'critical';
show_as: 'banner' | 'widget';
starts_at: string;
ends_at: string | null;
created_by: string | null;
@@ -13,6 +14,7 @@ export interface Banner {
export interface CreateBannerInput {
message: string;
level: 'info' | 'important' | 'critical';
show_as?: 'banner' | 'widget';
starts_at?: string;
ends_at?: string | null;
}
@@ -39,9 +41,9 @@ class BannerService {
async create(data: CreateBannerInput, userId: string): Promise<Banner> {
const result = await pool.query(
`INSERT INTO announcement_banners (message, level, starts_at, ends_at, created_by)
VALUES ($1, $2, $3, $4, $5) RETURNING *`,
[data.message, data.level, data.starts_at ?? new Date().toISOString(), data.ends_at ?? null, userId]
`INSERT INTO announcement_banners (message, level, show_as, starts_at, ends_at, created_by)
VALUES ($1, $2, $3, $4, $5, $6) RETURNING *`,
[data.message, data.level, data.show_as ?? 'banner', data.starts_at ?? new Date().toISOString(), data.ends_at ?? null, userId]
);
return result.rows[0];
}