Skip to content

Commit

Permalink
Added auth rules to schema
Browse files Browse the repository at this point in the history
  • Loading branch information
thedanielforum committed Apr 14, 2022
1 parent 41dc944 commit 3aa63e1
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions server/ikura.graphql
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
type User
@auth(
query: "z >> RT.FirebaseID | value | equals[info.context['auth']['USER_ID']]"
add: "params['firebaseID'] == info.context['auth']['USER_ID']"
query: """
(z >> RT.FirebaseId
| value
| equals[info.context
| get_in[('auth', 'USER_ID')][None]
| collect])
"""
) {
firebaseID: String! @unique @search
firebaseId: String! @unique @search
email: String @unique
givenName: String
familyName: String
Expand All @@ -16,8 +21,13 @@ type User

type Transaction
@auth(
query: "z >> RT.FirebaseID | value | equals[info.context['auth']['USER_ID']]"
add: "params['firebaseID'] == info.context['auth']['USER_ID']"
query: """
(z >> RT.User >> RT.FirebaseId
| value
| equals[info.context
| get_in[('auth', 'USER_ID')][None]
| collect])
"""
) {
user: User @relation(source: "Transaction", rt: "User", target: "User")
category: Category
Expand All @@ -26,7 +36,18 @@ type Transaction
date: DateTime
}

type Category {
type Category
@auth(
query: """
(Or
[Not[has_out[RT.User]]]
[Z >> RT.User >> RT.FirebaseId
| value
| equals[info.context
| get_in[('auth', 'USER_ID')][None]
| collect]])
"""
) {
user: User @relation(source: "Category", rt: "User", target: "User")
transactions: [Transaction]
@incoming
Expand Down

1 comment on commit 3aa63e1

@vercel
Copy link

@vercel vercel bot commented on 3aa63e1 Apr 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ikura – ./

www.ikura.app
ikura-zefhub.vercel.app
ikura-git-main-zefhub.vercel.app
ikura.vercel.app
ikura.app

Please sign in to comment.