feat(auth): add user and role management
This commit is contained in:
12
packages/web/src/graphql/mutations/create-role.ee.ts
Normal file
12
packages/web/src/graphql/mutations/create-role.ee.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const CREATE_ROLE = gql`
|
||||
mutation CreateRole($input: CreateRoleInput) {
|
||||
createRole(input: $input) {
|
||||
id
|
||||
key
|
||||
name
|
||||
description
|
||||
}
|
||||
}
|
||||
`;
|
@@ -3,8 +3,12 @@ import { gql } from '@apollo/client';
|
||||
export const CREATE_USER = gql`
|
||||
mutation CreateUser($input: CreateUserInput) {
|
||||
createUser(input: $input) {
|
||||
id
|
||||
email
|
||||
fullName
|
||||
role {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@@ -0,0 +1,7 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const DELETE_CURRENT_USER = gql`
|
||||
mutation DeleteCurrentUser {
|
||||
deleteCurrentUser
|
||||
}
|
||||
`;
|
7
packages/web/src/graphql/mutations/delete-role.ee.ts
Normal file
7
packages/web/src/graphql/mutations/delete-role.ee.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const DELETE_ROLE = gql`
|
||||
mutation DeleteRole($input: DeleteRoleInput) {
|
||||
deleteRole(input: $input)
|
||||
}
|
||||
`;
|
@@ -1,7 +1,7 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const DELETE_USER = gql`
|
||||
mutation DeleteUser {
|
||||
deleteUser
|
||||
mutation DeleteUser($input: DeleteUserInput) {
|
||||
deleteUser(input: $input)
|
||||
}
|
||||
`;
|
||||
|
11
packages/web/src/graphql/mutations/register-user.ee.ts
Normal file
11
packages/web/src/graphql/mutations/register-user.ee.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const REGISTER_USER = gql`
|
||||
mutation RegisterUser($input: RegisterUserInput) {
|
||||
registerUser(input: $input) {
|
||||
id
|
||||
email
|
||||
fullName
|
||||
}
|
||||
}
|
||||
`;
|
11
packages/web/src/graphql/mutations/update-current-user.ts
Normal file
11
packages/web/src/graphql/mutations/update-current-user.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const UPDATE_CURRENT_USER = gql`
|
||||
mutation UpdateCurrentUser($input: UpdateCurrentUserInput) {
|
||||
updateCurrentUser(input: $input) {
|
||||
id
|
||||
fullName
|
||||
email
|
||||
}
|
||||
}
|
||||
`;
|
17
packages/web/src/graphql/mutations/update-role.ee.ts
Normal file
17
packages/web/src/graphql/mutations/update-role.ee.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const UPDATE_ROLE = gql`
|
||||
mutation UpdateRole($input: UpdateRoleInput) {
|
||||
updateRole(input: $input) {
|
||||
id
|
||||
name
|
||||
description
|
||||
permissions {
|
||||
id
|
||||
action
|
||||
subject
|
||||
conditions
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
@@ -4,8 +4,8 @@ export const UPDATE_USER = gql`
|
||||
mutation UpdateUser($input: UpdateUserInput) {
|
||||
updateUser(input: $input) {
|
||||
id
|
||||
fullName
|
||||
email
|
||||
fullName
|
||||
}
|
||||
}
|
||||
`;
|
@@ -6,6 +6,16 @@ export const GET_CURRENT_USER = gql`
|
||||
id
|
||||
fullName
|
||||
email
|
||||
role {
|
||||
id
|
||||
isAdmin
|
||||
}
|
||||
permissions {
|
||||
id
|
||||
action
|
||||
subject
|
||||
conditions
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@@ -0,0 +1,21 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_PERMISSION_CATALOG = gql`
|
||||
query GetPermissionCatalog {
|
||||
getPermissionCatalog {
|
||||
subjects {
|
||||
key
|
||||
label
|
||||
}
|
||||
conditions {
|
||||
key
|
||||
label
|
||||
}
|
||||
actions {
|
||||
label
|
||||
key
|
||||
subjects
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
19
packages/web/src/graphql/queries/get-role.ee.ts
Normal file
19
packages/web/src/graphql/queries/get-role.ee.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_ROLE = gql`
|
||||
query GetRole($id: String!) {
|
||||
getRole(id: $id) {
|
||||
id
|
||||
key
|
||||
name
|
||||
description
|
||||
isAdmin
|
||||
permissions {
|
||||
id
|
||||
action
|
||||
subject
|
||||
conditions
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
13
packages/web/src/graphql/queries/get-roles.ee.ts
Normal file
13
packages/web/src/graphql/queries/get-roles.ee.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_ROLES = gql`
|
||||
query GetRoles {
|
||||
getRoles {
|
||||
id
|
||||
key
|
||||
name
|
||||
description
|
||||
isAdmin
|
||||
}
|
||||
}
|
||||
`;
|
19
packages/web/src/graphql/queries/get-user.ts
Normal file
19
packages/web/src/graphql/queries/get-user.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_USER = gql`
|
||||
query GetUser($id: String!) {
|
||||
getUser(id: $id) {
|
||||
id
|
||||
fullName
|
||||
email
|
||||
role {
|
||||
id
|
||||
key
|
||||
name
|
||||
isAdmin
|
||||
}
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
`;
|
29
packages/web/src/graphql/queries/get-users.ts
Normal file
29
packages/web/src/graphql/queries/get-users.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_USERS = gql`
|
||||
query GetUsers(
|
||||
$limit: Int!
|
||||
$offset: Int!
|
||||
) {
|
||||
getUsers(
|
||||
limit: $limit
|
||||
offset: $offset
|
||||
) {
|
||||
pageInfo {
|
||||
currentPage
|
||||
totalPages
|
||||
}
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
fullName
|
||||
email
|
||||
role {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
Reference in New Issue
Block a user