resolve issues with new features
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user