diff --git a/apps/mobile/devtools_options.yaml b/apps/mobile/devtools_options.yaml new file mode 100644 index 00000000..fa0b357c --- /dev/null +++ b/apps/mobile/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: diff --git a/backend/dataconnect/connector/costCenter/mutations.gql b/backend/dataconnect/connector/costCenter/mutations.gql index d671a6d1..a85e9ea8 100644 --- a/backend/dataconnect/connector/costCenter/mutations.gql +++ b/backend/dataconnect/connector/costCenter/mutations.gql @@ -1,37 +1,29 @@ - -# ---------------------------------------------------------- -# CREATE COST CENTER -# ---------------------------------------------------------- mutation createCostCenter( $name: String! - $createdBy: String -) @auth(level: USER) { + $businessId: UUID! + ) @auth(level: USER) { costCenter_insert( - data: { + data: { name: $name - createdBy: $createdBy + businessId: $businessId } ) } -# ---------------------------------------------------------- -# UPDATE COST CENTER -# ---------------------------------------------------------- mutation updateCostCenter( $id: UUID! $name: String -) @auth(level: USER) { + $businessId: UUID + ) @auth(level: USER) { costCenter_update( - id: $id - data: { + id: $id, + data: { name: $name + businessId: $businessId } ) } -# ---------------------------------------------------------- -# DELETE COST CENTER -# ---------------------------------------------------------- mutation deleteCostCenter($id: UUID!) @auth(level: USER) { costCenter_delete(id: $id) } diff --git a/backend/dataconnect/connector/costCenter/queries.gql b/backend/dataconnect/connector/costCenter/queries.gql index 678afbe0..374b4617 100644 --- a/backend/dataconnect/connector/costCenter/queries.gql +++ b/backend/dataconnect/connector/costCenter/queries.gql @@ -1,47 +1,30 @@ - -# ---------------------------------------------------------- -# LIST ALL COST CENTERS -# ---------------------------------------------------------- -query listCostCenters( - $offset: Int - $limit: Int -) @auth(level: USER) { - costCenters(offset: $offset, limit: $limit) { +query listCostCenters @auth(level: USER) { + costCenters { id name - createdAt - updatedAt - createdBy + businessId } } -# ---------------------------------------------------------- -# GET BY ID -# ---------------------------------------------------------- query getCostCenterById($id: UUID!) @auth(level: USER) { costCenter(id: $id) { id name - createdAt - updatedAt - createdBy + businessId } } -# ---------------------------------------------------------- -# GET COST CENTER LINKED TO A SPECIFIC HUB -# ---------------------------------------------------------- -query getCostCenterByHubId($hubId: UUID!) @auth(level: USER) { - hubs(where: { id: { eq: $hubId } }) { +query filterCostCenters( + $name: String, + $businessId: UUID + ) @auth(level: USER) { + costCenters( + where: { + name: { eq: $name }, + businessId: { eq: $businessId } + }) { id name - costCenterId - costCenter { - id - name - createdAt - updatedAt - createdBy - } + businessId } } diff --git a/backend/dataconnect/connector/teamHub/mutations.gql b/backend/dataconnect/connector/teamHub/mutations.gql index adf57c42..2609c460 100644 --- a/backend/dataconnect/connector/teamHub/mutations.gql +++ b/backend/dataconnect/connector/teamHub/mutations.gql @@ -1,5 +1,6 @@ mutation createTeamHub( $teamId: UUID! + $costCenterId: UUID $hubName: String! $address: String! @@ -20,6 +21,7 @@ mutation createTeamHub( teamHub_insert( data: { teamId: $teamId + costCenterId: $costCenterId hubName: $hubName address: $address @@ -45,6 +47,7 @@ mutation updateTeamHub( $id: UUID! $teamId: UUID + $costCenterId: UUID $hubName: String $address: String @@ -67,6 +70,7 @@ mutation updateTeamHub( id: $id data: { teamId: $teamId + costCenterId: $costCenterId hubName: $hubName address: $address @@ -90,4 +94,25 @@ mutation updateTeamHub( mutation deleteTeamHub($id: UUID!) @auth(level: USER) { teamHub_delete(id: $id) -} \ No newline at end of file +} + +mutation assignCostCenterToTeamHub( + $id: UUID! + $costCenterId: UUID! +) @auth(level: USER) { + teamHub_update( + id: $id + data: { + costCenterId: $costCenterId + } + ) +} + +mutation removeCostCenterFromTeamHub($id: UUID!) @auth(level: USER) { + teamHub_update( + id: $id + data: { + costCenterId: null + } + ) +} diff --git a/backend/dataconnect/connector/teamHub/queries.gql b/backend/dataconnect/connector/teamHub/queries.gql index 19619802..b0fa2721 100644 --- a/backend/dataconnect/connector/teamHub/queries.gql +++ b/backend/dataconnect/connector/teamHub/queries.gql @@ -8,6 +8,7 @@ query listTeamHubs($offset: Int, $limit: Int) @auth(level: USER) { teamHubs(offset: $offset, limit: $limit, orderBy: { createdAt: DESC }) { id teamId + costCenterId hubName address @@ -24,6 +25,11 @@ query listTeamHubs($offset: Int, $limit: Int) @auth(level: USER) { managerName isActive departments + costCenter { + id + name + businessId + } } } @@ -32,6 +38,7 @@ query getTeamHubById($id: UUID!) @auth(level: USER) { teamHub(id: $id) { id teamId + costCenterId hubName address @@ -48,6 +55,11 @@ query getTeamHubById($id: UUID!) @auth(level: USER) { managerName isActive departments + costCenter { + id + name + businessId + } } } @@ -65,6 +77,7 @@ query getTeamHubsByTeamId( ) { id teamId + costCenterId hubName address @@ -81,6 +94,11 @@ query getTeamHubsByTeamId( managerName isActive departments + costCenter { + id + name + businessId + } } } @@ -105,6 +123,7 @@ query listTeamHubsByOwnerId( ) { id teamId + costCenterId hubName address @@ -121,6 +140,11 @@ query listTeamHubsByOwnerId( managerName isActive departments + costCenter { + id + name + businessId + } } } diff --git a/backend/dataconnect/schema/costCenter.gql b/backend/dataconnect/schema/costCenter.gql index 2001dd28..11537e6d 100644 --- a/backend/dataconnect/schema/costCenter.gql +++ b/backend/dataconnect/schema/costCenter.gql @@ -1,6 +1,8 @@ type CostCenter @table(name: "cost_centers") { id: UUID! @default(expr: "uuidV4()") name: String! + businessId: UUID! + createdAt: Timestamp @default(expr: "request.time") updatedAt: Timestamp @default(expr: "request.time") createdBy: String diff --git a/backend/dataconnect/schema/hub.gql b/backend/dataconnect/schema/hub.gql deleted file mode 100644 index 7f4c234d..00000000 --- a/backend/dataconnect/schema/hub.gql +++ /dev/null @@ -1,13 +0,0 @@ -type Hub @table(name: "hubs") { - id: UUID! @default(expr: "uuidV4()") - name: String! - locationName: String - address: String - nfcTagId: String - ownerId: UUID! - costCenterId: UUID - costCenter: CostCenter @ref(fields: "costCenterId", references: "id") - createdAt: Timestamp @default(expr: "request.time") - updatedAt: Timestamp @default(expr: "request.time") - createdBy: String -} diff --git a/backend/dataconnect/schema/teamHub.gql b/backend/dataconnect/schema/teamHub.gql index faece738..e522e64f 100644 --- a/backend/dataconnect/schema/teamHub.gql +++ b/backend/dataconnect/schema/teamHub.gql @@ -3,6 +3,9 @@ type TeamHub @table(name: "team_hubs") { teamId: UUID! team: Team! @ref(fields: "teamId", references: "id") + + costCenterId: UUID + costCenter: CostCenter @ref(fields: "costCenterId", references: "id") hubName: String!