diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 776500f..a01b2be 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,11 +8,16 @@ Support can be asked in the `#contributions` channel of the [Plunk Discord serve - Docker needs to be [installed](https://docs.docker.com/engine/install/) on your system. -### 2. Set your environment variables +### 2. Install dependencies + +- Run `yarn install` to install the dependencies. + +### 3. Set your environment variables - Copy the `.env.example` files in the `api`, `dashboard` and `prisma` folder to `.env` in their respective folders. +- Set AWS credentials in the `api` `.env` file. -### 3. Start resources +### 4. Start resources - Run `yarn services:up` to start a local database and a local redis server. - Run `yarn migrate` to apply the migrations to the database. diff --git a/package.json b/package.json index 7ca2f97..6107515 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plunk", - "version": "1.0.7", + "version": "1.0.8", "private": true, "license": "agpl-3.0", "workspaces": { diff --git a/packages/api/.env.example b/packages/api/.env.example index 1215bdb..6d31462 100644 --- a/packages/api/.env.example +++ b/packages/api/.env.example @@ -1,7 +1,7 @@ # ENV JWT_SECRET=mysupersecretJWTsecret REDIS_URL=redis://127.0.0.1:56379 -DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres +DATABASE_URL=postgresql://postgres:postgres@localhost:55432/postgres DISABLE_SIGNUPS=false # AWS diff --git a/packages/api/src/controllers/v1/index.ts b/packages/api/src/controllers/v1/index.ts index 7137b21..9be09ff 100644 --- a/packages/api/src/controllers/v1/index.ts +++ b/packages/api/src/controllers/v1/index.ts @@ -78,15 +78,12 @@ export class V1 { redis.del(Keys.Contact.id(contact.id)); redis.del(Keys.Contact.email(project.id, contact.email)); } else { - if (subscribed && contact.subscribed !== subscribed) { - contact = await prisma.contact.update({ - where: { id: contact.id }, - data: { subscribed }, - }); - + if (subscribed !== null && contact.subscribed !== subscribed) { + contact = await prisma.contact.update({where: {id: contact.id}, data: {subscribed}}); + redis.del(Keys.Contact.id(contact.id)); redis.del(Keys.Contact.email(project.id, contact.email)); - } + } } if (data) {