new converstation entity
This commit is contained in:
39
dataconnect/connector/conversation/mutations.gql
Normal file
39
dataconnect/connector/conversation/mutations.gql
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
mutation CreateConversation(
|
||||||
|
$participants: String!,
|
||||||
|
$conversationType: ConversationType!,
|
||||||
|
$relatedTo: UUID!,
|
||||||
|
$status: ConversationStatus
|
||||||
|
) @auth(level: USER) {
|
||||||
|
conversation_insert(
|
||||||
|
data: {
|
||||||
|
participants: $participants
|
||||||
|
conversationType: $conversationType
|
||||||
|
relatedTo: $relatedTo
|
||||||
|
status: $status
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation UpdateConversation(
|
||||||
|
$id: UUID!,
|
||||||
|
$participants: String,
|
||||||
|
$conversationType: ConversationType,
|
||||||
|
$relatedTo: UUID!,
|
||||||
|
$status: ConversationStatus
|
||||||
|
) @auth(level: USER) {
|
||||||
|
conversation_update(
|
||||||
|
id: $id,
|
||||||
|
data: {
|
||||||
|
participants: $participants
|
||||||
|
conversationType: $conversationType
|
||||||
|
relatedTo: $relatedTo
|
||||||
|
status: $status
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation DeleteConversation(
|
||||||
|
$id: UUID!
|
||||||
|
) @auth(level: USER) {
|
||||||
|
conversation_delete(id: $id)
|
||||||
|
}
|
||||||
43
dataconnect/connector/conversation/queries.gql
Normal file
43
dataconnect/connector/conversation/queries.gql
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# dataconnect/connector/conversation/queries.gql
|
||||||
|
|
||||||
|
query listConversation @auth(level: USER) {
|
||||||
|
conversations {
|
||||||
|
id
|
||||||
|
participants
|
||||||
|
conversationType
|
||||||
|
relatedTo
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query getConversationById(
|
||||||
|
$id: UUID!
|
||||||
|
) @auth(level: USER) {
|
||||||
|
conversation(id: $id) {
|
||||||
|
id
|
||||||
|
participants
|
||||||
|
conversationType
|
||||||
|
relatedTo
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query filterConversation(
|
||||||
|
$conversationType: ConversationType,
|
||||||
|
$status: ConversationStatus,
|
||||||
|
$relatedTo: UUID!
|
||||||
|
) @auth(level: USER) {
|
||||||
|
conversations(
|
||||||
|
where: {
|
||||||
|
conversationType: { eq: $conversationType }
|
||||||
|
status: { eq: $status }
|
||||||
|
relatedTo: { eq: $relatedTo }
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
participants
|
||||||
|
conversationType
|
||||||
|
relatedTo
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}
|
||||||
26
dataconnect/schema/conversation.gql
Normal file
26
dataconnect/schema/conversation.gql
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
enum ConversationType {
|
||||||
|
CLIENT_VENDOR
|
||||||
|
STAFF_CLIENT
|
||||||
|
STAFF_ADMIN
|
||||||
|
VENDOR_ADMIN
|
||||||
|
CLIENT_ADMIN
|
||||||
|
GROUP_STAFF
|
||||||
|
GROUP_EVENT_STAFF
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ConversationStatus {
|
||||||
|
ACTIVE
|
||||||
|
ARCHIVED
|
||||||
|
CLOSED
|
||||||
|
}
|
||||||
|
|
||||||
|
type Conversation @table(name: "conversations") {
|
||||||
|
id: UUID! @default(expr: "uuidV4()")
|
||||||
|
participants: String! # participants (jsonb -> String, required array of strings)
|
||||||
|
conversationType: ConversationType!
|
||||||
|
relatedTo: UUID! # related_to (generic FK as string)
|
||||||
|
status: ConversationStatus
|
||||||
|
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