merge with dev

This commit is contained in:
José Salazar
2026-02-26 11:17:01 -05:00
parent f389b6de5b
commit 3cf791ddbf
8 changed files with 81 additions and 62 deletions

View File

@@ -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:

View File

@@ -1,37 +1,29 @@
# ----------------------------------------------------------
# CREATE COST CENTER
# ----------------------------------------------------------
mutation createCostCenter( mutation createCostCenter(
$name: String! $name: String!
$createdBy: String $businessId: UUID!
) @auth(level: USER) { ) @auth(level: USER) {
costCenter_insert( costCenter_insert(
data: { data: {
name: $name name: $name
createdBy: $createdBy businessId: $businessId
} }
) )
} }
# ----------------------------------------------------------
# UPDATE COST CENTER
# ----------------------------------------------------------
mutation updateCostCenter( mutation updateCostCenter(
$id: UUID! $id: UUID!
$name: String $name: String
$businessId: UUID
) @auth(level: USER) { ) @auth(level: USER) {
costCenter_update( costCenter_update(
id: $id id: $id,
data: { data: {
name: $name name: $name
businessId: $businessId
} }
) )
} }
# ----------------------------------------------------------
# DELETE COST CENTER
# ----------------------------------------------------------
mutation deleteCostCenter($id: UUID!) @auth(level: USER) { mutation deleteCostCenter($id: UUID!) @auth(level: USER) {
costCenter_delete(id: $id) costCenter_delete(id: $id)
} }

View File

@@ -1,47 +1,30 @@
query listCostCenters @auth(level: USER) {
# ---------------------------------------------------------- costCenters {
# LIST ALL COST CENTERS
# ----------------------------------------------------------
query listCostCenters(
$offset: Int
$limit: Int
) @auth(level: USER) {
costCenters(offset: $offset, limit: $limit) {
id id
name name
createdAt businessId
updatedAt
createdBy
} }
} }
# ----------------------------------------------------------
# GET BY ID
# ----------------------------------------------------------
query getCostCenterById($id: UUID!) @auth(level: USER) { query getCostCenterById($id: UUID!) @auth(level: USER) {
costCenter(id: $id) { costCenter(id: $id) {
id id
name name
createdAt businessId
updatedAt
createdBy
} }
} }
# ---------------------------------------------------------- query filterCostCenters(
# GET COST CENTER LINKED TO A SPECIFIC HUB $name: String,
# ---------------------------------------------------------- $businessId: UUID
query getCostCenterByHubId($hubId: UUID!) @auth(level: USER) { ) @auth(level: USER) {
hubs(where: { id: { eq: $hubId } }) { costCenters(
where: {
name: { eq: $name },
businessId: { eq: $businessId }
}) {
id id
name name
costCenterId businessId
costCenter {
id
name
createdAt
updatedAt
createdBy
}
} }
} }

View File

@@ -1,5 +1,6 @@
mutation createTeamHub( mutation createTeamHub(
$teamId: UUID! $teamId: UUID!
$costCenterId: UUID
$hubName: String! $hubName: String!
$address: String! $address: String!
@@ -20,6 +21,7 @@ mutation createTeamHub(
teamHub_insert( teamHub_insert(
data: { data: {
teamId: $teamId teamId: $teamId
costCenterId: $costCenterId
hubName: $hubName hubName: $hubName
address: $address address: $address
@@ -45,6 +47,7 @@ mutation updateTeamHub(
$id: UUID! $id: UUID!
$teamId: UUID $teamId: UUID
$costCenterId: UUID
$hubName: String $hubName: String
$address: String $address: String
@@ -67,6 +70,7 @@ mutation updateTeamHub(
id: $id id: $id
data: { data: {
teamId: $teamId teamId: $teamId
costCenterId: $costCenterId
hubName: $hubName hubName: $hubName
address: $address address: $address
@@ -91,3 +95,24 @@ mutation updateTeamHub(
mutation deleteTeamHub($id: UUID!) @auth(level: USER) { mutation deleteTeamHub($id: UUID!) @auth(level: USER) {
teamHub_delete(id: $id) teamHub_delete(id: $id)
} }
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
}
)
}

View File

@@ -8,6 +8,7 @@ query listTeamHubs($offset: Int, $limit: Int) @auth(level: USER) {
teamHubs(offset: $offset, limit: $limit, orderBy: { createdAt: DESC }) { teamHubs(offset: $offset, limit: $limit, orderBy: { createdAt: DESC }) {
id id
teamId teamId
costCenterId
hubName hubName
address address
@@ -24,6 +25,11 @@ query listTeamHubs($offset: Int, $limit: Int) @auth(level: USER) {
managerName managerName
isActive isActive
departments departments
costCenter {
id
name
businessId
}
} }
} }
@@ -32,6 +38,7 @@ query getTeamHubById($id: UUID!) @auth(level: USER) {
teamHub(id: $id) { teamHub(id: $id) {
id id
teamId teamId
costCenterId
hubName hubName
address address
@@ -48,6 +55,11 @@ query getTeamHubById($id: UUID!) @auth(level: USER) {
managerName managerName
isActive isActive
departments departments
costCenter {
id
name
businessId
}
} }
} }
@@ -65,6 +77,7 @@ query getTeamHubsByTeamId(
) { ) {
id id
teamId teamId
costCenterId
hubName hubName
address address
@@ -81,6 +94,11 @@ query getTeamHubsByTeamId(
managerName managerName
isActive isActive
departments departments
costCenter {
id
name
businessId
}
} }
} }
@@ -105,6 +123,7 @@ query listTeamHubsByOwnerId(
) { ) {
id id
teamId teamId
costCenterId
hubName hubName
address address
@@ -121,6 +140,11 @@ query listTeamHubsByOwnerId(
managerName managerName
isActive isActive
departments departments
costCenter {
id
name
businessId
}
} }
} }

View File

@@ -1,6 +1,8 @@
type CostCenter @table(name: "cost_centers") { type CostCenter @table(name: "cost_centers") {
id: UUID! @default(expr: "uuidV4()") id: UUID! @default(expr: "uuidV4()")
name: String! name: String!
businessId: UUID!
createdAt: Timestamp @default(expr: "request.time") createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time") updatedAt: Timestamp @default(expr: "request.time")
createdBy: String createdBy: String

View File

@@ -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
}

View File

@@ -4,6 +4,9 @@ type TeamHub @table(name: "team_hubs") {
teamId: UUID! teamId: UUID!
team: Team! @ref(fields: "teamId", references: "id") team: Team! @ref(fields: "teamId", references: "id")
costCenterId: UUID
costCenter: CostCenter @ref(fields: "costCenterId", references: "id")
hubName: String! hubName: String!
address: String! address: String!