Save discord invite code instead of the whole URL

This commit is contained in:
Kalle
2022-07-30 13:19:54 +03:00
parent 57fb28a449
commit fc252568b8
4 changed files with 9 additions and 6 deletions

View File

@@ -330,7 +330,7 @@ function calendarEvents() {
"id",
"name",
"description",
"discordUrl",
"discordInviteCode",
"bracketUrl",
"authorId",
"tags"
@@ -338,7 +338,7 @@ function calendarEvents() {
$id,
$name,
$description,
$discordUrl,
$discordInviteCode,
$bracketUrl,
$authorId,
$tags
@@ -351,7 +351,7 @@ function calendarEvents() {
faker.word.noun()
)}`,
description: faker.lorem.paragraph(),
discordUrl: faker.internet.url(),
discordInviteCode: faker.lorem.word(),
bracketUrl: faker.internet.url(),
authorId: userIds.pop(),
tags:

View File

@@ -85,6 +85,8 @@ export interface CalendarEvent {
authorId: number;
tags?: string;
description: string | null;
discordInviteCode: string | null;
// generated column
discordUrl: string | null;
bracketUrl: string;
participantCount: number | null;

View File

@@ -180,8 +180,8 @@ function DatesInput() {
function DiscordLinkInput() {
return (
<div className="stack items-start">
<Label htmlFor="discordUrl">Discord server invite URL</Label>
<Input name="discordUrl" leftAddon="https://discord.gg/" />
<Label htmlFor="discordInviteCode">Discord server invite URL</Label>
<Input name="discordInviteCode" leftAddon="https://discord.gg/" />
</div>
);
}

View File

@@ -7,7 +7,8 @@ module.exports.up = function (db) {
"authorId" integer not null,
"bracketUrl" text not null,
"description" text,
"discordUrl" text,
"discordInviteCode" text,
"discordUrl" text generated always as ('https://discord.gg/' || "discordInviteCode") virtual,
"participantCount" integer,
"tags" text,
foreign key ("authorId") references "User"("id") on delete restrict