diff --git a/.gitignore b/.gitignore index 7100bc0..a0198d2 100644 --- a/.gitignore +++ b/.gitignore @@ -57,7 +57,7 @@ node_modules /build /.svelte-kit /package -.env +#.env .env.* !.env.example .vercel diff --git a/backend/.env b/backend/.env new file mode 100644 index 0000000..f661589 --- /dev/null +++ b/backend/.env @@ -0,0 +1,15 @@ +ST_API_URL=http://server.home:3567 +ST_API_KEY=56e5638525c7385faaf4f10d781d64e81e0ae9e2ef5e6cf7328064e8f1d377c7 +APP_PORT=3300 +APP_NAME=Fluxem +APP_URL=http://localhost:3300 +WEBAPP_URL=http://localhost:3000 + +# This was inserted by `prisma init`: +# Environment variables declared in this file are automatically made available to Prisma. +# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema + +# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB. +# See the documentation for all the connection string options: https://pris.ly/d/connection-strings + +DATABASE_URL="postgresql://postgres:502bde780ce8ba101572@server.home:5432/fluxem?schema=public" \ No newline at end of file diff --git a/backend/package.json b/backend/package.json index c61b8b8..ba4d245 100644 --- a/backend/package.json +++ b/backend/package.json @@ -28,6 +28,7 @@ "@nestjs/graphql": "^10.1.1", "@nestjs/mapped-types": "*", "@nestjs/platform-express": "^9.0.0", + "@prisma/client": "4.3.1", "apollo-server-express": "^3.10.2", "graphql": "^16.6.0", "reflect-metadata": "^0.1.13", @@ -46,6 +47,7 @@ "@types/supertest": "^2.0.11", "jest": "28.1.3", "prettier": "^2.3.2", + "prisma": "4.3.1", "source-map-support": "^0.5.20", "supertest": "^6.1.3", "ts-jest": "28.0.8", diff --git a/backend/prisma/migrations/20220907234937_init/migration.sql b/backend/prisma/migrations/20220907234937_init/migration.sql new file mode 100644 index 0000000..5b2a956 --- /dev/null +++ b/backend/prisma/migrations/20220907234937_init/migration.sql @@ -0,0 +1,11 @@ +-- CreateTable +CREATE TABLE "User" ( + "id" TEXT NOT NULL, + "email" TEXT NOT NULL, + "time_joined" INTEGER NOT NULL, + + CONSTRAINT "User_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); diff --git a/backend/prisma/migrations/migration_lock.toml b/backend/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..fbffa92 --- /dev/null +++ b/backend/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "postgresql" \ No newline at end of file diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma new file mode 100644 index 0000000..f693828 --- /dev/null +++ b/backend/prisma/schema.prisma @@ -0,0 +1,17 @@ +// 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()) + email String @unique + time_joined Int +} diff --git a/backend/yarn.lock b/backend/yarn.lock index 2d9050a..df64f72 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -947,6 +947,23 @@ resolved "https://registry.yarnpkg.com/@panva/asn1.js/-/asn1.js-1.0.0.tgz#dd55ae7b8129e02049f009408b97c61ccf9032f6" integrity sha512-UdkG3mLEqXgnlKsWanWcgb6dOjUzJ+XC5f+aWw30qrtjxeNUSfKX1cd5FBzOaXQumoe9nIqeZUvrRJS03HCCtw== +"@prisma/client@4.3.1": + version "4.3.1" + resolved "https://registry.yarnpkg.com/@prisma/client/-/client-4.3.1.tgz#b9aad9bd9bd43e7f715ec1d763c8bd9273688800" + integrity sha512-FA0/d1VMJNWqzU7WVWTNWJ+lGOLR9JUBnF73GdIPAEVo/6dWk4gHx0EmgeU+SMv4MZoxgOeTBJF2azhg7x0hMw== + dependencies: + "@prisma/engines-version" "4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b" + +"@prisma/engines-version@4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b": + version "4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b" + resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b.tgz#a564dd6fb6f25405fe06164989ebd8a1e4bb3508" + integrity sha512-8yWpXkQRmiSfsi2Wb/ZS5D3RFbeu/btL9Pm/gdF4phB0Lo5KGsDFMxFMgaD64mwED2nHc8ZaEJg/+4Jymb9Znw== + +"@prisma/engines@4.3.1": + version "4.3.1" + resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-4.3.1.tgz#fb0ad69eded13827fb4cd81995a351c234e8327f" + integrity sha512-4JF/uMaEDAPdcdZNOrnzE3BvrbGpjgV0FcPT3EVoi6I86fWkloqqxBt+KcK/+fIRR0Pxj66uGR9wVH8U1Y13JA== + "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" @@ -4076,6 +4093,13 @@ pretty-format@^28.0.0, pretty-format@^28.1.3: ansi-styles "^5.0.0" react-is "^18.0.0" +prisma@4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/prisma/-/prisma-4.3.1.tgz#9e4c24e49710392be40ee75fb3d9341d7487881e" + integrity sha512-90xo06wtqil76Xsi3mNpc4Js3SdDRR5g4qb9h+4VWY4Y8iImJY6xc3PX+C9xxTSt1lr0Q89A0MLkJjd8ax6KiQ== + dependencies: + "@prisma/engines" "4.3.1" + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index fb57ccd..0000000 --- a/yarn.lock +++ /dev/null @@ -1,4 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - -