Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,388 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,25 +15,32 @@ Bootstrap the environment: | |
|
||
``` | ||
docker-compose up -d | ||
npm run setup | ||
pnpm setup | ||
``` | ||
|
||
Note: If you need to tweak default settings, `cp .env.example .env` and go to town. | ||
|
||
Setup the database: | ||
|
||
``` | ||
make create-db | ||
pnpm db migrate | ||
``` | ||
|
||
Create a local user to avoid setting up Google credentials: | ||
|
||
``` | ||
npm run user:create e -w apps/api | ||
pnpm user create [email protected] password -a | ||
``` | ||
|
||
Run the dev server, which spins up both the `web` and the `api` services: | ||
Load some mock data: | ||
|
||
``` | ||
npm run dev | ||
pnpm mocks load-all [email protected] | ||
``` | ||
|
||
NX is used to manage the monorepo, e.g. | ||
Run the dev server, which spins up both the `web` and the `api` services: | ||
|
||
``` | ||
npx nx run-many -t build | ||
npm run dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
ALTER TYPE "object_type" ADD VALUE 'tasting'; | ||
ALTER TYPE "object_type" ADD VALUE 'toast'; | ||
ALTER TYPE "object_type" ADD VALUE 'follow'; | ||
CREATE TABLE IF NOT EXISTS "notifications" ( | ||
"id" bigserial PRIMARY KEY NOT NULL, | ||
"user_id" bigint NOT NULL, | ||
"from_user_id" bigint, | ||
"object_id" bigint NOT NULL, | ||
"object_type" object_type NOT NULL, | ||
"created_at" timestamp NOT NULL, | ||
"read" boolean DEFAULT false NOT NULL | ||
); | ||
|
||
DO $$ BEGIN | ||
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
|
||
DO $$ BEGIN | ||
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_from_user_id_user_id_fk" FOREIGN KEY ("from_user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
|
||
CREATE UNIQUE INDEX IF NOT EXISTS "notifications_unq" ON "notifications" ("user_id","object_id","object_type","created_at"); |
Oops, something went wrong.