setup prisma

This commit is contained in:
Hri7566 2023-09-06 19:59:44 -04:00
parent 0575a45782
commit dee62128bd
8 changed files with 44 additions and 25 deletions

4
.env.template Normal file
View File

@ -0,0 +1,4 @@
DATABASE_URL="sqlite:./db.sqlite"
PORT=8443
ADMINPASS=
SALT=

View File

@ -26,6 +26,7 @@
},
"devDependencies": {
"@types/node": "^20.5.9",
"prisma": "^5.2.0",
"typescript": "^5.2.2"
}
}

View File

@ -46,6 +46,9 @@ devDependencies:
'@types/node':
specifier: ^20.5.9
version: 20.5.9
prisma:
specifier: ^5.2.0
version: 5.2.0
typescript:
specifier: ^5.2.2
version: 5.2.2
@ -74,6 +77,11 @@ packages:
fast-json-stringify: 5.8.0
dev: false
/@prisma/engines@5.2.0:
resolution: {integrity: sha512-dT7FOLUCdZmq+AunLqB1Iz+ZH/IIS1Fz2THmKZQ6aFONrQD/BQ5ecJ7g2wGS2OgyUFf4OaLam6/bxmgdOBDqig==}
requiresBuild: true
dev: true
/@t3-oss/env-core@0.6.1(typescript@5.2.2)(zod@3.22.2):
resolution: {integrity: sha512-KQD7qEDJtkWIWWmTVjNvk0wnHpkvAQ6CRbUxbWMFNG/fiosBQDQvtRpBNu6USxBscJCoC4z6y7P9MN52/mLOzw==}
peerDependencies:
@ -466,6 +474,15 @@ packages:
hasBin: true
dev: false
/prisma@5.2.0:
resolution: {integrity: sha512-FfFlpjVCkZwrqxDnP4smlNYSH1so+CbfjgdpioFzGGqlQAEm6VHAYSzV7jJgC3ebtY9dNOhDMS2+4/1DDSM7bQ==}
engines: {node: '>=16.13'}
hasBin: true
requiresBuild: true
dependencies:
'@prisma/engines': 5.2.0
dev: true
/process-warning@2.2.0:
resolution: {integrity: sha512-/1WZ8+VQjR6avWOgHeEPd7SDQmFQ1B5mC1eRXsCm5TarlNmx/wCsa5GEaxGm05BORRtyG/Ex/3xq3TuRvq57qg==}
dev: false

11
prisma/schema.prisma Normal file
View File

@ -0,0 +1,11 @@
// 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")
}

View File

@ -0,0 +1,5 @@
import fastify from "fastify";
export const app = fastify({
});

View File

@ -0,0 +1,6 @@
import { app } from "http/fastify";
import env from "util/env";
app.listen({
port: env.PORT
});

View File

@ -1,25 +0,0 @@
const Crown = require('../src/Crown');
describe('Crown', () => {
it('has a starting position of 50, 50', () => {
const crown = new Crown();
expect(crown.startPos.x).toBe(50);
expect(crown.startPos.y).toBe(50);
});
it('has a starting timestamp of Date.now()', () => {
const crown = new Crown();
expect(crown.time).toBeLessThanOrEqual(Date.now());
});
it('has a random end position', () => {
const crown = new Crown();
expect(crown.endPos.x).toBeLessThanOrEqual(100);
expect(crown.endPos.x).toBeGreaterThanOrEqual(0);
expect(crown.endPos.y).toBeLessThanOrEqual(100);
expect(crown.endPos.y).toBeGreaterThanOrEqual(0);
});
});