Skip to content

Commit

Permalink
fix: appDevice user field
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed Aug 8, 2024
1 parent ad18461 commit 72a7eca
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"test-notification": "cross-env NODE_ENV=development node ./src/scripts/test-notification.js",
"dev-cron": "nodemon ./src/cronjobs.js ",
"create-migration": "cross-env NODE_ENV=development npx prisma migrate dev --name",
"apply-migration-on-new-dev-db": "cross-env NODE_ENV=development npx prisma migrate deploy",
"start": "NODE_ENV=production npx prisma migrate deploy && NODE_ENV=production node ./src/server.js",
"postinstall": "prisma generate",
"test": "jest",
Expand Down
2 changes: 2 additions & 0 deletions api/prisma/migrations/20240808125617_app_device/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "appDevice" TEXT;
1 change: 1 addition & 0 deletions api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ model User {
updatedAt DateTime @default(now()) @updatedAt
drinksContextRequests DrinksContextRequest[]
appVersion String?
appDevice String?
strategies Strategy[]
isOverWritten Boolean @default(false)
Expand Down
2 changes: 2 additions & 0 deletions api/src/controllers/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ router.post(

if (action === "APP_OPEN") {
const appVersion = req.headers.appversion;
const appDevice = req.headers.appdevice;
await prisma.user.update({
where: { matomo_id: matomoId },
data: {
appVersion: appVersion,
appDevice: appDevice,
},
});
}
Expand Down

0 comments on commit 72a7eca

Please sign in to comment.