From 0ac3ad9c2b92d270ac5444ade028ff24826ff053 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Thu, 28 Jul 2022 23:01:45 +0300 Subject: [PATCH] addTagArray typing from global type --- TODO.md | 2 +- app/db/models/calendar.server.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index 79f895480..fee27798c 100644 --- a/TODO.md +++ b/TODO.md @@ -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 diff --git a/app/db/models/calendar.server.ts b/app/db/models/calendar.server.ts index 9980b96e5..07f8aaa6b 100644 --- a/app/db/models/calendar.server.ts +++ b/app/db/models/calendar.server.ts @@ -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; if (hasBadge) tags.push("BADGE_PRIZE");