Merge pull request #91 from Oloodi/90-backend-define-and-deploy-team-schema
new team entity
This commit is contained in:
47
dataconnect/connector/team/mutations.gql
Normal file
47
dataconnect/connector/team/mutations.gql
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
mutation CreateTeam(
|
||||||
|
$teamName: String!,
|
||||||
|
$ownerId: UUID!,
|
||||||
|
$ownerName: String!,
|
||||||
|
$ownerRole: TeamOwnerRole!,
|
||||||
|
$favoriteStaff: String,
|
||||||
|
$blockedStaff: String
|
||||||
|
) @auth(level: USER) {
|
||||||
|
team_insert(
|
||||||
|
data: {
|
||||||
|
teamName: $teamName
|
||||||
|
ownerId: $ownerId
|
||||||
|
ownerName: $ownerName
|
||||||
|
ownerRole: $ownerRole
|
||||||
|
favoriteStaff: $favoriteStaff
|
||||||
|
blockedStaff: $blockedStaff
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation UpdateTeam(
|
||||||
|
$id: UUID!,
|
||||||
|
$teamName: String,
|
||||||
|
$ownerId: UUID,
|
||||||
|
$ownerName: String,
|
||||||
|
$ownerRole: TeamOwnerRole,
|
||||||
|
$favoriteStaff: String,
|
||||||
|
$blockedStaff: String
|
||||||
|
) @auth(level: USER) {
|
||||||
|
team_update(
|
||||||
|
id: $id,
|
||||||
|
data: {
|
||||||
|
teamName: $teamName
|
||||||
|
ownerId: $ownerId
|
||||||
|
ownerName: $ownerName
|
||||||
|
ownerRole: $ownerRole
|
||||||
|
favoriteStaff: $favoriteStaff
|
||||||
|
blockedStaff: $blockedStaff
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation DeleteTeam(
|
||||||
|
$id: UUID!
|
||||||
|
) @auth(level: USER) {
|
||||||
|
team_delete(id: $id)
|
||||||
|
}
|
||||||
47
dataconnect/connector/team/queries.gql
Normal file
47
dataconnect/connector/team/queries.gql
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
query listTeam @auth(level: USER) {
|
||||||
|
teams {
|
||||||
|
id
|
||||||
|
teamName
|
||||||
|
ownerId
|
||||||
|
ownerName
|
||||||
|
ownerRole
|
||||||
|
favoriteStaff
|
||||||
|
blockedStaff
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query getTeamById(
|
||||||
|
$id: UUID!
|
||||||
|
) @auth(level: USER) {
|
||||||
|
team(id: $id) {
|
||||||
|
id
|
||||||
|
teamName
|
||||||
|
ownerId
|
||||||
|
ownerName
|
||||||
|
ownerRole
|
||||||
|
favoriteStaff
|
||||||
|
blockedStaff
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query filterTeam(
|
||||||
|
$teamName: String,
|
||||||
|
$ownerId: UUID,
|
||||||
|
$ownerRole: TeamOwnerRole
|
||||||
|
) @auth(level: USER) {
|
||||||
|
teams(
|
||||||
|
where: {
|
||||||
|
teamName: { eq: $teamName }
|
||||||
|
ownerId: { eq: $ownerId }
|
||||||
|
ownerRole: { eq: $ownerRole }
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
teamName
|
||||||
|
ownerId
|
||||||
|
ownerName
|
||||||
|
ownerRole
|
||||||
|
favoriteStaff
|
||||||
|
blockedStaff
|
||||||
|
}
|
||||||
|
}
|
||||||
22
dataconnect/schema/team.gql
Normal file
22
dataconnect/schema/team.gql
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
enum TeamOwnerRole {
|
||||||
|
ADMIN
|
||||||
|
PROCUREMENT
|
||||||
|
OPERATOR
|
||||||
|
SECTOR
|
||||||
|
CLIENT
|
||||||
|
VENDOR
|
||||||
|
WORKFORCE
|
||||||
|
}
|
||||||
|
|
||||||
|
type Team @table(name: "team") {
|
||||||
|
id: UUID! @default(expr: "uuidV4()")
|
||||||
|
teamName: String!
|
||||||
|
ownerId: UUID!
|
||||||
|
ownerName: String!
|
||||||
|
ownerRole: TeamOwnerRole!
|
||||||
|
favoriteStaff: String
|
||||||
|
blockedStaff: String
|
||||||
|
createdDate: Timestamp @default(expr: "request.time")
|
||||||
|
updatedDate: Timestamp @default(expr: "request.time")
|
||||||
|
createdBy: String @default(expr: "auth.uid")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user