More consistent date columns

This commit is contained in:
Kalle
2026-07-26 15:14:24 +03:00
parent 4b48a45109
commit 4cf2003e3c
109 changed files with 536 additions and 404 deletions

View File

@@ -1014,8 +1014,8 @@ export function buildCases(fx: Fixtures): {
add("UserRepository.inGameNameByUserId", fx.heavyUser, (user) =>
UserRepository.inGameNameByUserId(user.id),
);
add("UserRepository.patronSinceByUserId", fx.heavyUser, (user) =>
UserRepository.patronSinceByUserId(user.id),
add("UserRepository.patronStartedAtByUserId", fx.heavyUser, (user) =>
UserRepository.patronStartedAtByUserId(user.id),
);
add("UserRepository.joinOrderByUserId", fx.heavyUser, (user) =>
UserRepository.joinOrderByUserId(user.id),

View File

@@ -644,9 +644,9 @@ async function resolveHeavyOrg() {
"CalendarEventDate.eventId",
"CalendarEvent.id",
)
.select(["CalendarEvent.name", "CalendarEventDate.startTime"])
.select(["CalendarEvent.name", "CalendarEventDate.startsAt"])
.where("CalendarEvent.organizationId", "=", orgRow.id)
.orderBy("CalendarEventDate.startTime", "desc")
.orderBy("CalendarEventDate.startsAt", "desc")
.limit(1)
.executeTakeFirst();
if (!latestEvent) return null;

View File

@@ -55,11 +55,11 @@ const tournaments = await db
"Tournament.settings",
"Tournament.isFinalized",
"CalendarEvent.name",
"CalendarEventDate.startTime",
"CalendarEventDate.startsAt",
])
.where("CalendarEventDate.startTime", ">=", seasonStartTimestamp)
.where("CalendarEventDate.startTime", "<=", seasonEndTimestamp)
.orderBy("CalendarEventDate.startTime")
.where("CalendarEventDate.startsAt", ">=", seasonStartTimestamp)
.where("CalendarEventDate.startsAt", "<=", seasonEndTimestamp)
.orderBy("CalendarEventDate.startsAt")
.execute();
const unfinalizedTournaments = tournaments.filter(

View File

@@ -75,7 +75,7 @@ async function main() {
name: `${tournament.ctx.name} - ${div.startsWith("Division") ? div : `Division ${div}`}`,
organizationId: tournament.ctx.organization?.id ?? null,
rules: tournament.ctx.rules,
startTimes: [dateToDatabaseTimestamp(tournament.ctx.startTime)],
startTimes: [dateToDatabaseTimestamp(tournament.ctx.startsAt)],
tags: null,
tournamentToCopyId: tournament.ctx.id,
avatarImgId: calendarEvent.avatarImgId ?? undefined,

View File

@@ -78,8 +78,8 @@ async function getParticipantsForOrgInMonth(
)
.select(({ fn }) => fn.count<number>("tmgrp.userId").distinct().as("count"))
.where("ce.organizationId", "=", organizationId)
.where("ced.startTime", ">=", startTimestamp)
.where("ced.startTime", "<", endTimestamp)
.where("ced.startsAt", ">=", startTimestamp)
.where("ced.startsAt", "<", endTimestamp)
.where("ttci.checkedInAt", "is not", null)
.where("ttci.isCheckOut", "=", 0)
.executeTakeFirst();
@@ -98,7 +98,7 @@ async function getOrgsWithRecentTournaments(
.select("ce.organizationId")
.distinct()
.where("ce.organizationId", "is not", null)
.where("ced.startTime", ">=", earliestTimestamp)
.where("ced.startsAt", ">=", earliestTimestamp)
.execute();
return orgs.map((org) => org.organizationId!);