addTagArray typing from global type

This commit is contained in:
Kalle 2022-07-28 23:01:45 +03:00
parent 61ace7e9b2
commit 0ac3ad9c2b
2 changed files with 9 additions and 3 deletions

View File

@ -22,6 +22,6 @@ Calendar
- [x] Type problem with Avatar
- [x] Maybe classNames that do nothing on calendar event page?
- [x] refactor global.css/common.css -> variables.css / utils.css / common.css
- [ ] addTagArray get tags type from constant
- [x] addTagArray get tags type from constant
- [x] Rename model events -> calendarEvents
- [x] On the event page should not say Day 1 if only one day

View File

@ -1,6 +1,12 @@
import { dateToDatabaseTimestamp } from "~/utils/dates";
import { sql } from "../sql";
import type { CalendarEvent, CalendarEventDate, User, Badge } from "../types";
import type {
CalendarEvent,
CalendarEventDate,
User,
Badge,
CalendarEventTag,
} from "../types";
const findAllBetweenTwoTimestampsStm = sql.prepare(`
select
@ -37,7 +43,7 @@ function addTagArray<
T extends { hasBadge: number; tags?: CalendarEvent["tags"] }
>(arg: T) {
const { hasBadge, ...row } = arg;
const tags = (row.tags ? row.tags.split(",") : []) as Array<"BADGE_PRIZE">;
const tags = (row.tags ? row.tags.split(",") : []) as Array<CalendarEventTag>;
if (hasBadge) tags.push("BADGE_PRIZE");