Feature/add permissions to access model (#2833)

* Add permissions to Access model

* Update changelog
This commit is contained in:
Thomas Kaul 2024-01-24 19:23:58 +01:00 committed by GitHub
parent 04fc2cd3e1
commit 73c0843d51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 20 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
- Added `permissions` to the `Access` model
## 2.44.0 - 2024-01-24 ## 2.44.0 - 2024-01-24
### Fixed ### Fixed

View File

@ -0,0 +1,5 @@
-- CreateEnum
CREATE TYPE "AccessPermission" AS ENUM ('READ', 'READ_RESTRICTED');
-- AlterTable
ALTER TABLE "Access" ADD COLUMN "permissions" "AccessPermission"[] DEFAULT ARRAY['READ_RESTRICTED']::"AccessPermission"[];

View File

@ -11,31 +11,32 @@ datasource db {
model Access { model Access {
alias String? alias String?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
granteeUserId String? granteeUserId String?
id String @id @default(uuid()) id String @id @default(uuid())
updatedAt DateTime @updatedAt permissions AccessPermission[] @default([READ_RESTRICTED])
updatedAt DateTime @updatedAt
userId String userId String
GranteeUser User? @relation("accessGet", fields: [granteeUserId], references: [id]) GranteeUser User? @relation("accessGet", fields: [granteeUserId], references: [id])
User User @relation("accessGive", fields: [userId], references: [id]) User User @relation("accessGive", fields: [userId], references: [id])
} }
model Account { model Account {
balance Float @default(0) balance Float @default(0)
balances AccountBalance[] balances AccountBalance[]
comment String? comment String?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
currency String? currency String?
id String @default(uuid()) id String @default(uuid())
isDefault Boolean @default(false) isDefault Boolean @default(false)
isExcluded Boolean @default(false) isExcluded Boolean @default(false)
name String? name String?
platformId String? platformId String?
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
userId String userId String
Platform Platform? @relation(fields: [platformId], references: [id]) Platform Platform? @relation(fields: [platformId], references: [id])
User User @relation(fields: [userId], references: [id]) User User @relation(fields: [userId], references: [id])
Order Order[] Order Order[]
@@id([id, userId]) @@id([id, userId])
} }
@ -196,6 +197,11 @@ model User {
Subscription Subscription[] Subscription Subscription[]
} }
enum AccessPermission {
READ
READ_RESTRICTED
}
enum AssetClass { enum AssetClass {
CASH CASH
COMMODITY COMMODITY