Reset
This commit is contained in:
21
.gitignore
vendored
21
.gitignore
vendored
@@ -1,21 +0,0 @@
|
||||
node_modules
|
||||
|
||||
# Output
|
||||
.output
|
||||
.vercel
|
||||
/.svelte-kit
|
||||
/build
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Env
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
!.env.test
|
||||
|
||||
# Vite
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# Package Managers
|
||||
package-lock.json
|
||||
pnpm-lock.yaml
|
||||
yarn.lock
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"useTabs": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100,
|
||||
"plugins": ["prettier-plugin-svelte"],
|
||||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
||||
}
|
||||
38
README.md
38
README.md
@@ -1,38 +0,0 @@
|
||||
# create-svelte
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm create svelte@latest
|
||||
|
||||
# create a new project in my-app
|
||||
npm create svelte@latest my-app
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
To create a production version of your app:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
You can preview the production build with `npm run preview`.
|
||||
|
||||
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
||||
@@ -1,33 +0,0 @@
|
||||
import js from '@eslint/js';
|
||||
import ts from 'typescript-eslint';
|
||||
import svelte from 'eslint-plugin-svelte';
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import globals from 'globals';
|
||||
|
||||
/** @type {import('eslint').Linter.Config[]} */
|
||||
export default [
|
||||
js.configs.recommended,
|
||||
...ts.configs.recommended,
|
||||
...svelte.configs['flat/recommended'],
|
||||
prettier,
|
||||
...svelte.configs['flat/prettier'],
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.svelte'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
parser: ts.parser
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
ignores: ['build/', '.svelte-kit/', 'dist/']
|
||||
}
|
||||
];
|
||||
6721
package-lock.json
generated
6721
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
49
package.json
49
package.json
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"name": "bracketeer",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"prisma": {
|
||||
"seed": "ts-node prisma/seed.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"test": "vitest",
|
||||
"lint": "prettier --check . && eslint .",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-auto": "^3.0.0",
|
||||
"@sveltejs/adapter-node": "^5.2.2",
|
||||
"@sveltejs/kit": "^2.0.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||
"@types/eslint": "^9.6.0",
|
||||
"@types/node": "^22.5.0",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"eslint": "^9.0.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-svelte": "^2.36.0",
|
||||
"globals": "^15.0.0",
|
||||
"postcss": "^8.4.41",
|
||||
"prettier": "^3.1.1",
|
||||
"prettier-plugin-svelte": "^3.1.2",
|
||||
"prisma": "^5.19.0",
|
||||
"svelte": "^5.0.0-next.1",
|
||||
"svelte-check": "^3.6.0",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.5.4",
|
||||
"typescript-eslint": "^8.0.0",
|
||||
"vite": "^5.0.3",
|
||||
"vitest": "^2.0.0"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@clerk/backend": "^1.13.1",
|
||||
"@prisma/client": "^5.19.0",
|
||||
"clerk-sveltekit": "^0.4.2"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
export default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "PhaseType" AS ENUM ('DOUBLE_ELIM', 'SINGLE_ELIM', 'ROUND_ROBIN');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "UserRole" (
|
||||
"userId" TEXT NOT NULL,
|
||||
"roleId" INTEGER NOT NULL,
|
||||
|
||||
CONSTRAINT "UserRole_pkey" PRIMARY KEY ("userId","roleId")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Role" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "Role_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Tournament" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"slug" TEXT,
|
||||
"creatorUserId" TEXT NOT NULL,
|
||||
"created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "Tournament_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Event" (
|
||||
"id" TEXT NOT NULL,
|
||||
"gameId" INTEGER NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"tournamentId" TEXT NOT NULL,
|
||||
"created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "Event_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Phase" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"type" "PhaseType" NOT NULL,
|
||||
"bracketCount" INTEGER NOT NULL,
|
||||
"phaseWinnerCount" INTEGER NOT NULL,
|
||||
"eventId" TEXT NOT NULL,
|
||||
"created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "Phase_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Bracket" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"phaseId" TEXT,
|
||||
|
||||
CONSTRAINT "Bracket_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Player" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"name" TEXT,
|
||||
"userId" TEXT NOT NULL,
|
||||
"created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"userConfirmed" BOOLEAN NOT NULL DEFAULT false,
|
||||
|
||||
CONSTRAINT "Player_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "EventPlayer" (
|
||||
"eventId" TEXT NOT NULL,
|
||||
"playerId" INTEGER NOT NULL,
|
||||
"seed" INTEGER NOT NULL,
|
||||
"manuallySeeded" BOOLEAN NOT NULL DEFAULT false,
|
||||
|
||||
CONSTRAINT "EventPlayer_pkey" PRIMARY KEY ("eventId","playerId")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Game" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"slug" TEXT,
|
||||
"created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "Game_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_admins" (
|
||||
"A" TEXT NOT NULL,
|
||||
"B" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_moderators" (
|
||||
"A" TEXT NOT NULL,
|
||||
"B" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_admins_AB_unique" ON "_admins"("A", "B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_admins_B_index" ON "_admins"("B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_moderators_AB_unique" ON "_moderators"("A", "B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_moderators_B_index" ON "_moderators"("B");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "UserRole" ADD CONSTRAINT "UserRole_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "UserRole" ADD CONSTRAINT "UserRole_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES "Role"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Tournament" ADD CONSTRAINT "Tournament_creatorUserId_fkey" FOREIGN KEY ("creatorUserId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Event" ADD CONSTRAINT "Event_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Event" ADD CONSTRAINT "Event_tournamentId_fkey" FOREIGN KEY ("tournamentId") REFERENCES "Tournament"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Phase" ADD CONSTRAINT "Phase_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Bracket" ADD CONSTRAINT "Bracket_phaseId_fkey" FOREIGN KEY ("phaseId") REFERENCES "Phase"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Player" ADD CONSTRAINT "Player_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventPlayer" ADD CONSTRAINT "EventPlayer_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventPlayer" ADD CONSTRAINT "EventPlayer_playerId_fkey" FOREIGN KEY ("playerId") REFERENCES "Player"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_admins" ADD CONSTRAINT "_admins_A_fkey" FOREIGN KEY ("A") REFERENCES "Tournament"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_admins" ADD CONSTRAINT "_admins_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_moderators" ADD CONSTRAINT "_moderators_A_fkey" FOREIGN KEY ("A") REFERENCES "Tournament"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_moderators" ADD CONSTRAINT "_moderators_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -1,24 +0,0 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "UserAuth" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"userId" TEXT NOT NULL,
|
||||
"providerId" INTEGER NOT NULL,
|
||||
"value" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "UserAuth_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "AuthProvider" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"providerValue" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "AuthProvider_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "UserAuth" ADD CONSTRAINT "UserAuth_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "UserAuth" ADD CONSTRAINT "UserAuth_providerId_fkey" FOREIGN KEY ("providerId") REFERENCES "AuthProvider"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `email` to the `User` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "email" TEXT NOT NULL;
|
||||
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[providerId,value]` on the table `UserAuth` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "UserAuth_providerId_value_key" ON "UserAuth"("providerId", "value");
|
||||
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[providerValue]` on the table `AuthProvider` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "AuthProvider_providerValue_key" ON "AuthProvider"("providerValue");
|
||||
@@ -1,3 +0,0 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "postgresql"
|
||||
@@ -1,136 +0,0 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid(7))
|
||||
name String
|
||||
email String
|
||||
created DateTime @default(now())
|
||||
userRoles UserRole[]
|
||||
auth UserAuth[]
|
||||
tournamntsAdministrating Tournament[] @relation("admins")
|
||||
tournamentsModerating Tournament[] @relation("moderators")
|
||||
Tournament Tournament[]
|
||||
Player Player[]
|
||||
}
|
||||
|
||||
model UserAuth {
|
||||
id Int @id @default(autoincrement())
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
provider AuthProvider @relation(fields: [providerId], references: [id])
|
||||
providerId Int
|
||||
value String
|
||||
|
||||
@@unique(name: "providerIdAuthValue", [providerId, value])
|
||||
}
|
||||
|
||||
model AuthProvider {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
providerValue String @unique
|
||||
userAuth UserAuth[]
|
||||
}
|
||||
|
||||
model UserRole {
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
role Role @relation(fields: [roleId], references: [id])
|
||||
roleId Int
|
||||
|
||||
@@id([userId, roleId])
|
||||
}
|
||||
|
||||
model Role {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
userRoles UserRole[]
|
||||
}
|
||||
|
||||
model Tournament {
|
||||
id String @id @default(uuid(7))
|
||||
name String
|
||||
slug String?
|
||||
creator User @relation(fields: [creatorUserId], references: [id])
|
||||
creatorUserId String
|
||||
created DateTime @default(now())
|
||||
admins User[] @relation("admins")
|
||||
moderators User[] @relation("moderators")
|
||||
events Event[]
|
||||
}
|
||||
|
||||
model Event {
|
||||
id String @id @default(uuid(7))
|
||||
game Game @relation(fields: [gameId], references: [id])
|
||||
gameId Int
|
||||
entrants EventPlayer[]
|
||||
title String
|
||||
phases Phase[]
|
||||
tournament Tournament @relation(fields: [tournamentId], references: [id])
|
||||
tournamentId String
|
||||
created DateTime @default(now())
|
||||
}
|
||||
|
||||
enum PhaseType {
|
||||
DOUBLE_ELIM
|
||||
SINGLE_ELIM
|
||||
ROUND_ROBIN
|
||||
}
|
||||
|
||||
model Phase {
|
||||
id String @id @default(uuid(7))
|
||||
name String
|
||||
type PhaseType
|
||||
bracketCount Int
|
||||
phaseWinnerCount Int
|
||||
event Event @relation(fields: [eventId], references: [id])
|
||||
eventId String
|
||||
created DateTime @default(now())
|
||||
brackets Bracket[]
|
||||
}
|
||||
|
||||
model Bracket {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
created DateTime @default(now())
|
||||
Phase Phase? @relation(fields: [phaseId], references: [id])
|
||||
phaseId String?
|
||||
}
|
||||
|
||||
model Player {
|
||||
id Int @id @default(autoincrement())
|
||||
name String?
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
created DateTime @default(now())
|
||||
userConfirmed Boolean @default(false)
|
||||
EventPlayer EventPlayer[]
|
||||
}
|
||||
|
||||
model EventPlayer {
|
||||
event Event @relation(fields: [eventId], references: [id])
|
||||
eventId String
|
||||
player Player @relation(fields: [playerId], references: [id])
|
||||
playerId Int
|
||||
seed Int
|
||||
manuallySeeded Boolean @default(false)
|
||||
|
||||
@@id([eventId, playerId])
|
||||
}
|
||||
|
||||
model Game {
|
||||
id Int @id @default(autoincrement())
|
||||
title String
|
||||
slug String?
|
||||
created DateTime @default(now())
|
||||
Event Event[]
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
32
src/app.d.ts
vendored
32
src/app.d.ts
vendored
@@ -1,32 +0,0 @@
|
||||
// See https://kit.svelte.dev/docs/types#app
|
||||
// for information about these interfaces
|
||||
import { User } from '@clerk/backend';
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
interface Locals {
|
||||
session:
|
||||
{
|
||||
prefix: string | undefined,
|
||||
username: string | undefined,
|
||||
userId: string,
|
||||
claims: {
|
||||
azp: string,
|
||||
exp: number,
|
||||
iat: number,
|
||||
iss: string,
|
||||
nbf: number,
|
||||
sid: string,
|
||||
sub: string
|
||||
}
|
||||
}
|
||||
| undefined,
|
||||
clerkUser: User | undefined
|
||||
}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
}
|
||||
}
|
||||
|
||||
export { };
|
||||
12
src/app.html
12
src/app.html
@@ -1,12 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
import type { HandleClientError } from '@sveltejs/kit'
|
||||
import { initializeClerkClient } from 'clerk-sveltekit/client'
|
||||
import { PUBLIC_CLERK_PUBLISHABLE_KEY } from '$env/static/public'
|
||||
|
||||
initializeClerkClient(PUBLIC_CLERK_PUBLISHABLE_KEY, {
|
||||
afterSignInUrl: '/admin/',
|
||||
afterSignUpUrl: '/admin/',
|
||||
signInUrl: '/sign-in',
|
||||
signUpUrl: '/sign-up',
|
||||
})
|
||||
|
||||
export const handleError: HandleClientError = async ({ error, event }) => {
|
||||
console.error(error, event)
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
import type { Handle } from '@sveltejs/kit'
|
||||
import { sequence } from '@sveltejs/kit/hooks'
|
||||
import { handleClerk } from 'clerk-sveltekit/server'
|
||||
import { CLERK_SECRET_KEY } from '$env/static/private'
|
||||
import prisma from '$lib/prisma';
|
||||
import { createClerkClient } from '@clerk/backend';
|
||||
const getClearkUserObject: Handle = async function({ event, resolve }) {
|
||||
if (event.locals.session?.userId == null) {
|
||||
return await resolve(event);
|
||||
}
|
||||
const clerkClient = createClerkClient({ secretKey: CLERK_SECRET_KEY });
|
||||
event.locals.clerkUser = await clerkClient.users.getUser(event.locals.session.userId);
|
||||
return await resolve(event);
|
||||
};
|
||||
|
||||
const localUserHandle: Handle = async function({ event, resolve }) {
|
||||
console.debug('Adding or Grabbing new user', event.locals);
|
||||
if (event.locals.session == null || event.locals.clerkUser == null) {
|
||||
return await resolve(event);
|
||||
}
|
||||
let provider = await prisma.authProvider.findUnique({
|
||||
where: {
|
||||
providerValue: event.locals.session!.claims!.iss,
|
||||
}
|
||||
});
|
||||
if (provider == null) {
|
||||
console.debug('Provider does not exist', event.locals.session!.claims.iss);
|
||||
provider = await prisma.authProvider.create({
|
||||
data: {
|
||||
name: event.locals.session!.claims.iss,
|
||||
providerValue: event.locals.session!.claims.iss,
|
||||
}
|
||||
});
|
||||
}
|
||||
const userAuthValue = await prisma.userAuth.findUnique({
|
||||
where: {
|
||||
providerIdAuthValue: {
|
||||
providerId: provider.id,
|
||||
value: event.locals.session?.userId
|
||||
}
|
||||
},
|
||||
include: {
|
||||
user: true,
|
||||
}
|
||||
});
|
||||
let userObject = userAuthValue?.user;
|
||||
if (userAuthValue == null) {
|
||||
//create a user for this identity
|
||||
console.debug(`User doesn't exist, creating`,);
|
||||
userObject = await prisma.user.create({
|
||||
data: {
|
||||
name: event.locals.clerkUser!.username!,
|
||||
email: event.locals.clerkUser!.primaryEmailAddress!.emailAddress,
|
||||
auth: {
|
||||
create: [
|
||||
{
|
||||
value: event.locals.clerkUser.id,
|
||||
providerId: provider.id
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
});
|
||||
event.locals.session.username = userObject.name;
|
||||
}
|
||||
console.debug('Found/Created user', userObject);
|
||||
|
||||
const result = await resolve(event);
|
||||
return result;
|
||||
};
|
||||
|
||||
export const handle: Handle = sequence(
|
||||
handleClerk(CLERK_SECRET_KEY, {
|
||||
debug: true,
|
||||
protectedPaths: ['/admin'],
|
||||
signInUrl: '/sign-in',
|
||||
}),
|
||||
getClearkUserObject,
|
||||
localUserHandle
|
||||
)
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('sum test', () => {
|
||||
it('adds 1 + 2 to equal 3', () => {
|
||||
expect(1 + 2).toBe(3);
|
||||
});
|
||||
});
|
||||
@@ -1,15 +0,0 @@
|
||||
export default interface PlayerCellDto {
|
||||
name: string,
|
||||
playerId: string,
|
||||
prefix?: string,
|
||||
character?: string,
|
||||
seed: number,
|
||||
}
|
||||
export interface PlayerSet {
|
||||
player1: PlayerCellDto,
|
||||
player2: PlayerCellDto,
|
||||
winner?: PlayerCellDto,
|
||||
matchId: string,
|
||||
}
|
||||
export class Round {
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type PlayerSet from '$lib/DTOs/PlayerCellDto';
|
||||
import PlayerCell from './PlayerCell.svelte';
|
||||
interface HeadToHeadCellProps {
|
||||
playerSet: PlayerSet;
|
||||
}
|
||||
|
||||
let { playerSet } = $props();
|
||||
console.debug(playerSet);
|
||||
const winnerStyles = 'border-emerald-800 ring-2 ring-inset ring-emerald-500';
|
||||
const loserStyles = 'text-neutral-300';
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col">
|
||||
<div class="text-sm self-center text-zinc-400">
|
||||
╭ Match {playerSet.matchId} ╮
|
||||
</div>
|
||||
<div
|
||||
class="px-1 flex border rounded-t-md border-zinc-600 {playerSet.winner.playerId ===
|
||||
playerSet.player1.playerId
|
||||
? winnerStyles
|
||||
: ''}"
|
||||
>
|
||||
<div class="flex-1 overflow-hidden">
|
||||
<PlayerCell playerCell={playerSet.player1} />
|
||||
</div>
|
||||
<div class="text-zinc-400">{playerSet.player1.seed}</div>
|
||||
</div>
|
||||
<div class="px-1 flex border border-t-0 rounded-b-md border-zinc-600 {loserStyles} ">
|
||||
<div class="flex-1 overflow-hidden">
|
||||
<PlayerCell playerCell={playerSet.player2} />
|
||||
</div>
|
||||
<div class="text-zinc-400">{playerSet.player2.seed}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,16 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type PlayerCellDto from '$lib/DTOs/PlayerCellDto';
|
||||
interface PlayerCellProps {
|
||||
playerCell: PlayerCellDto;
|
||||
isWinner?: boolean;
|
||||
}
|
||||
let { playerCell, isWinner }: PlayerCellProps = $props();
|
||||
</script>
|
||||
|
||||
{#if playerCell.prefix != null}
|
||||
<span class="text-inherit text-neutral-400"> {playerCell.prefix} | </span>
|
||||
{/if}
|
||||
{playerCell.name}
|
||||
{#if playerCell.character != null}
|
||||
<img src="" />
|
||||
{/if}
|
||||
@@ -1 +0,0 @@
|
||||
// place files you want to import through the `$lib` alias in this folder.
|
||||
@@ -1,6 +0,0 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export default prisma;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<script lang="ts">
|
||||
import "../app.css";
|
||||
import UserButton from 'clerk-sveltekit/client/UserButton.svelte'
|
||||
import SignedIn from 'clerk-sveltekit/client/SignedIn.svelte'
|
||||
import SignedOut from 'clerk-sveltekit/client/SignedOut.svelte'
|
||||
</script>
|
||||
|
||||
<nav class="fixed bg-slate-600 w-64 left-0 p-3 text-white h-screen z-20 flex flex-col">
|
||||
<ul>
|
||||
<li>Home</li>
|
||||
<li>Events</li>
|
||||
<li>Communities</li>
|
||||
<li>Leagues</li>
|
||||
<li class="relative end-0">
|
||||
</li>
|
||||
</ul>
|
||||
<div class="mb-0">
|
||||
<SignedIn>
|
||||
<UserButton afterSignOutUrl="/" />
|
||||
</SignedIn>
|
||||
<SignedOut>
|
||||
<a href="/sign-in">Sign in</a> <span>|</span> <a href="/sign-up">Sign up</a>
|
||||
<!-- You could also use <SignInButton mode="modal" /> and <SignUpButton mode="modal" /> here -->
|
||||
</SignedOut>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="ml-64 p-1">
|
||||
<div class="container mx-auto">
|
||||
<slot/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
import prisma from '$lib/prisma';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load = (async () => {
|
||||
const response = await prisma.event.count();
|
||||
return { eventCount: response };
|
||||
}) satisfies PageServerLoad;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from "./$types";
|
||||
export let data: PageData;
|
||||
</script>
|
||||
|
||||
|
||||
Event Count: {data.eventCount}
|
||||
@@ -1,8 +0,0 @@
|
||||
import prisma from '$lib/prisma';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load = (async (event) => {
|
||||
console.log('Checking session for user object', event.locals);
|
||||
return { };
|
||||
}) satisfies PageServerLoad;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<p>Site Admin Dashboard</p>
|
||||
@@ -1,104 +0,0 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import type PlayerCellDto from '$lib/DTOs/PlayerCellDto';
|
||||
import type { PlayerSet } from '$lib/DTOs/PlayerCellDto';
|
||||
|
||||
export const load: PageServerLoad = async ({ params }) => {
|
||||
const characterClasses = [
|
||||
"Warrior",
|
||||
"Mage",
|
||||
"Archer",
|
||||
"Rogue",
|
||||
"Paladin",
|
||||
"Sorcerer",
|
||||
"Druid",
|
||||
"Monk",
|
||||
"Necromancer",
|
||||
"Bard",
|
||||
"Knight",
|
||||
"Assassin",
|
||||
"Barbarian",
|
||||
"Cleric",
|
||||
"Wizard",
|
||||
"Ranger",
|
||||
"Enchanter",
|
||||
"Samurai",
|
||||
"Alchemist",
|
||||
"Summoner",
|
||||
"Beastmaster",
|
||||
"Elementalist",
|
||||
"Dark Knight",
|
||||
"Guardian",
|
||||
"Illusionist",
|
||||
"Pirate",
|
||||
"Shadowblade",
|
||||
"Berserker",
|
||||
"Healer",
|
||||
"Sorceress",
|
||||
"Tempest",
|
||||
"Sage",
|
||||
"Priestess",
|
||||
"Gladiator",
|
||||
"Mystic",
|
||||
"Elemental",
|
||||
"Arcane",
|
||||
"Swordsman",
|
||||
"Invoker",
|
||||
"Warlock",
|
||||
"Dancer",
|
||||
"Enforcer",
|
||||
"Runemaster",
|
||||
"Shaman",
|
||||
"Spiritbinder",
|
||||
"Templar",
|
||||
"Mystic",
|
||||
"Sorcerer",
|
||||
"Valkyrie",
|
||||
"Paladin",
|
||||
"Warrior",
|
||||
"Bard",
|
||||
"Monk",
|
||||
"Assassin",
|
||||
"Cleric",
|
||||
"Ranger",
|
||||
"Druid",
|
||||
];
|
||||
|
||||
const names = [
|
||||
"Alice", "Bob", "Charlie", "Diana", "Ethan", "Fiona", "George", "Hannah",
|
||||
"Ian", "Julia", "Kevin", "Laura", "Michael", "Nina", "Oscar", "Paula",
|
||||
"Quentin", "Rachel", "Steven", "Tina", "Uma", "Victor", "Wendy", "Xander",
|
||||
"Yvonne", "Zach", "Aaron", "Bella", "Caleb", "Daisy", "Eli", "Faith",
|
||||
"Gavin", "Hazel", "Isaac", "Jasmine", "Kyle", "Lily", "Mason", "Nora",
|
||||
"Owen", "Piper", "Quincy", "Riley", "Sean", "Tara", "Ulysses", "Valerie",
|
||||
"Walter", "Xenia", "Yusuf", "Zara", "Adam", "Bianca", "Connor", "Delilah",
|
||||
"Evan", "Faye", "Grant", "Hailey", "Ivan", "Jenna", "Kevin", "Lara"
|
||||
];
|
||||
|
||||
const prefixes = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
const generatePlayerCell = (index: number): PlayerCellDto => {
|
||||
const prefix = prefixes[index % prefixes.length];
|
||||
return {
|
||||
name: names[index],
|
||||
playerId: `p${String(index + 1).padStart(3, "0")}`,
|
||||
prefix: prefix,
|
||||
character: characterClasses[index % characterClasses.length],
|
||||
seed: index + 1, // Ensures unique seed
|
||||
};
|
||||
};
|
||||
|
||||
const round1: Array<PlayerSet> = new Array<PlayerSet>();
|
||||
for (let i = 0; i < 32; i++) {
|
||||
const player1 = generatePlayerCell(i * 2);
|
||||
const set: PlayerSet = {
|
||||
player1,
|
||||
player2: generatePlayerCell(i * 2 + 1),
|
||||
winner: player1,
|
||||
matchId: `A${i + 1}`,
|
||||
}
|
||||
round1.push(set);
|
||||
}
|
||||
|
||||
return { rounds: [round1,] };
|
||||
};
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<script lang="ts">
|
||||
import HeadToHeadCell from '$lib/components/HeadToHeadCell.svelte';
|
||||
import type { PageData } from './$types';
|
||||
let { data }: { data: PageData } = $props();
|
||||
console.debug(data);
|
||||
</script>
|
||||
|
||||
<div class="flex">
|
||||
{#each data.rounds as round}
|
||||
<div class="min-w-36">
|
||||
{#each round as match}
|
||||
<HeadToHeadCell playerSet={match} />
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -1,7 +0,0 @@
|
||||
<script lang="ts">
|
||||
import SignIn from 'clerk-sveltekit/client/SignIn.svelte'
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<SignIn redirectUrl="/admin" />
|
||||
</div>
|
||||
@@ -1,7 +0,0 @@
|
||||
<script lang="ts">
|
||||
import SignUp from 'clerk-sveltekit/client/SignUp.svelte'
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<SignUp redirectUrl="/admin" />
|
||||
</div>
|
||||
@@ -1,7 +0,0 @@
|
||||
<script lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<form action="POST">
|
||||
|
||||
</form>
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
<script lang="ts">
|
||||
import UserProfile from "clerk-sveltekit/client/UserProfile.svelte";
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<div class="w-full">
|
||||
<div class="mx-auto">
|
||||
<UserProfile/>
|
||||
</div>
|
||||
</div>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -1,18 +0,0 @@
|
||||
import adapter from '@sveltejs/adapter-auto';
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
kit: {
|
||||
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
||||
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||
adapter: adapter()
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -1,9 +0,0 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: ['./src/**/*.{html,js,svelte,ts}'],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"moduleResolution": "bundler"
|
||||
}
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
||||
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
|
||||
//
|
||||
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [sveltekit()],
|
||||
test: {
|
||||
include: ['src/**/*.{test,spec}.{js,ts}']
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user