From ce8c502dd973c419dea0cc53ee5f413c3009e0b7 Mon Sep 17 00:00:00 2001 From: Volodymyr_Zhuravlov Date: Sun, 19 Feb 2023 00:38:43 +0200 Subject: [PATCH 1/2] fix: update MongoDB records Add docker-compose, update README & Fix update records when provider is MongoDB --- .env.example | 1 + README.md | 9 +++++++-- docker-compose.yml | 17 +++++++++++++++++ package.json | 3 ++- src/Resource.ts | 3 +++ 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .env.example create mode 100644 docker-compose.yml diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..6253ad2 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +DATABASE_URL=postgresql://admin:superadmin@localhost:5432/postgres diff --git a/README.md b/README.md index ab18f5e..32796ec 100644 --- a/README.md +++ b/README.md @@ -82,10 +82,15 @@ You can do this by running: ``` yarn lint -yarn test ``` -Make sure you have an `.env` file with `DATABASE_URL` specified. +### To run test do next: +``` +1. cp .env.example .env +2. docker-compose up -d +3. yarn prisma-migrate +4. yarn test +``` ## License diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ad8cc65 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3' + +services: + postgres-local: + container_name: adminjs_prisma + image: postgres + restart: always + environment: + POSTGRES_DB: postgres + POSTGRES_USER: admin + POSTGRES_PASSWORD: superadmin + PGDATA: /data/postgres + ports: + - '5432:5432' + +volumes: + data: diff --git a/package.json b/package.json index beb7fc1..35fd121 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "ts-node": "ts-node", "lint": "eslint './src/**/*.{ts,js}' './spec/**/*.{ts,js}' './example-app/**/*.{ts,js}' --ignore-pattern 'build' --ignore-pattern 'yarn.lock'", "check:all": "yarn lint && yarn test && yarn build", - "release": "semantic-release" + "release": "semantic-release", + "prisma-migrate": "prisma migrate dev --name init" }, "repository": { "type": "git", diff --git a/src/Resource.ts b/src/Resource.ts index 3a4b334..9422fa6 100644 --- a/src/Resource.ts +++ b/src/Resource.ts @@ -168,6 +168,9 @@ export class Resource extends BaseResource { const param = flat.get(params, property.path()); const key = property.path(); + // eslint-disable-next-line no-continue + if (key === 'id') continue; + // eslint-disable-next-line no-continue if (param === undefined) continue; From 8bc45f887ac0c086c6116293d75f61a50f376831 Mon Sep 17 00:00:00 2001 From: Volodymyr_Zhuravlov Date: Sun, 19 Feb 2023 00:51:28 +0200 Subject: [PATCH 2/2] build: bump the version Bump the version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 35fd121..08a61a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adminjs/prisma", - "version": "3.0.1", + "version": "3.0.2", "description": "Prisma adapter for AdminJS", "keywords": [ "prisma",