Skip to content

Commit 709e6c8

Browse files
committed
feat(prisma db): two new permissions, (auth.controller.ts): updated json login response.
1 parent 9b9f894 commit 709e6c8

File tree

6 files changed

+81
-52
lines changed

6 files changed

+81
-52
lines changed

package-lock.json

Lines changed: 64 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"homepage": "https://github.com/kevinduncke/medsoft-api#readme",
2626
"dependencies": {
2727
"@prisma/adapter-pg": "^7.3.0",
28-
"@prisma/client": "^7.3.0",
28+
"@prisma/client": "^7.4.1",
2929
"@types/cors": "^2.8.19",
3030
"@types/express": "^5.0.6",
3131
"@types/node": "^25.2.0",
@@ -42,7 +42,7 @@
4242
"@types/bcrypt": "^6.0.0",
4343
"@types/jest": "^30.0.0",
4444
"@types/jsonwebtoken": "^9.0.10",
45-
"prisma": "^7.3.0",
45+
"prisma": "^7.4.1",
4646
"typescript": "^5.9.3"
4747
}
4848
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- AlterEnum
2+
-- This migration adds more than one value to an enum.
3+
-- With PostgreSQL versions 11 and earlier, this is not possible
4+
-- in a single migration. This can be worked around by creating
5+
-- multiple migrations, each migration adding only one value to
6+
-- the enum.
7+
8+
9+
ALTER TYPE "Permission" ADD VALUE 'VIEW_PERMISSIONS';
10+
ALTER TYPE "Permission" ADD VALUE 'EDIT_PERMISSIONS';

prisma/schema.prisma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ enum Role {
1616
enum Permission {
1717
MANAGE_USERS
1818
MANAGE_ROLES
19+
VIEW_PERMISSIONS
20+
EDIT_PERMISSIONS
1921
VIEW_PATIENTS
2022
NEW_PATIENTS
2123
EDIT_PATIENTS

prisma/seed.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ async function main() {
3434
permissions: [
3535
"MANAGE_USERS",
3636
"MANAGE_ROLES",
37+
"VIEW_PERMISSIONS",
38+
"EDIT_PERMISSIONS",
3739
"VIEW_PATIENTS",
3840
"NEW_PATIENTS",
3941
"EDIT_PATIENTS",

src/controllers/auth.controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const login = async (req: Request, res: Response) => {
4141
id: user.id,
4242
email: user.email,
4343
role: user.role,
44+
permissions: user.permissions,
4445
},
4546
});
4647
} catch (err) {

0 commit comments

Comments
 (0)