fix: Issue 523, 536 to delete duplicate queries and create cost center schema and queries
This commit is contained in:
37
backend/dataconnect/connector/costCenter/mutations.gql
Normal file
37
backend/dataconnect/connector/costCenter/mutations.gql
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# CREATE COST CENTER
|
||||
# ----------------------------------------------------------
|
||||
mutation createCostCenter(
|
||||
$name: String!
|
||||
$createdBy: String
|
||||
) @auth(level: USER) {
|
||||
costCenter_insert(
|
||||
data: {
|
||||
name: $name
|
||||
createdBy: $createdBy
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# UPDATE COST CENTER
|
||||
# ----------------------------------------------------------
|
||||
mutation updateCostCenter(
|
||||
$id: UUID!
|
||||
$name: String
|
||||
) @auth(level: USER) {
|
||||
costCenter_update(
|
||||
id: $id
|
||||
data: {
|
||||
name: $name
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# DELETE COST CENTER
|
||||
# ----------------------------------------------------------
|
||||
mutation deleteCostCenter($id: UUID!) @auth(level: USER) {
|
||||
costCenter_delete(id: $id)
|
||||
}
|
||||
47
backend/dataconnect/connector/costCenter/queries.gql
Normal file
47
backend/dataconnect/connector/costCenter/queries.gql
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# LIST ALL COST CENTERS
|
||||
# ----------------------------------------------------------
|
||||
query listCostCenters(
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
costCenters(offset: $offset, limit: $limit) {
|
||||
id
|
||||
name
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# GET BY ID
|
||||
# ----------------------------------------------------------
|
||||
query getCostCenterById($id: UUID!) @auth(level: USER) {
|
||||
costCenter(id: $id) {
|
||||
id
|
||||
name
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# GET COST CENTER LINKED TO A SPECIFIC HUB
|
||||
# ----------------------------------------------------------
|
||||
query getCostCenterByHubId($hubId: UUID!) @auth(level: USER) {
|
||||
hubs(where: { id: { eq: $hubId } }) {
|
||||
id
|
||||
name
|
||||
costCenterId
|
||||
costCenter {
|
||||
id
|
||||
name
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user