Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/connectors/accounts/connector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
connectorId: accounts
generate:
adminNodeSdk:
- package: "@generated/accounts-data-connector-admin"
outputDir: ../../../generated/accounts-data-connector-admin
91 changes: 91 additions & 0 deletions data/connectors/accounts/mutations.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
mutation CreateAccount(
$id: UUID!
$ownerId: String!
$companyName: String!
$businessNumber: String
$phoneNumber: String
) @auth(level: NO_ACCESS) {
account_insert(
data: {
id: $id
ownerId: $ownerId
companyName: $companyName
businessNumber: $businessNumber
phoneNumber: $phoneNumber
createdAt_expr: "request.time"
updatedAt_expr: "request.time"
}
)
}

mutation UpdateAccount(
$id: UUID!
$companyName: String
$businessNumber: String
$phoneNumber: String
$primaryContactId: UUID
) @auth(level: NO_ACCESS) {
account_update(
id: $id
data: {
companyName: $companyName
businessNumber: $businessNumber
phoneNumber: $phoneNumber
primaryContactId: $primaryContactId
updatedAt_expr: "request.time"
}
)
}

mutation DeleteAccountContacts($accountId: UUID!) @auth(level: NO_ACCESS) {
accountContact_deleteMany(where: { accountId: { eq: $accountId } })
}

mutation DeleteAccount($id: UUID!) @auth(level: NO_ACCESS) {
account_delete(id: $id)
}

mutation CreateAccountContact(
$id: UUID!
$accountId: UUID!
$name: String!
$email: String
$phoneNumber: String
$role: String
) @auth(level: NO_ACCESS) {
accountContact_insert(
data: {
id: $id
accountId: $accountId
name: $name
email: $email
phoneNumber: $phoneNumber
role: $role
createdAt_expr: "request.time"
updatedAt_expr: "request.time"
}
)
}

mutation UpdateAccountContact(
$id: UUID!
$name: String
$email: String
$phoneNumber: String
$role: String
) @auth(level: NO_ACCESS) {
accountContact_update(
id: $id
data: {
name: $name
email: $email
phoneNumber: $phoneNumber
role: $role
updatedAt_expr: "request.time"
}
)
}

mutation DeleteAccountContact($id: UUID!) @auth(level: NO_ACCESS) {
accountContact_delete(id: $id)
}
73 changes: 73 additions & 0 deletions data/connectors/accounts/queries.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
query ListAccountsByOwner($ownerId: String!) @auth(level: NO_ACCESS) {
accounts(
where: { ownerId: { eq: $ownerId } }
orderBy: [{ updatedAt: DESC }]
) {
id
ownerId
companyName
businessNumber
phoneNumber
primaryContactId
createdAt
updatedAt
}
}

query GetAccountById($id: UUID!) @auth(level: NO_ACCESS) {
account(id: $id) {
id
ownerId
companyName
businessNumber
phoneNumber
primaryContactId
createdAt
updatedAt
contacts: accountContacts_on_account(orderBy: [{ createdAt: ASC }]) {
id
accountId
name
email
phoneNumber
role
createdAt
updatedAt
}
}
}

query ListAccountContactsByAccountId($accountId: UUID!)
@auth(level: NO_ACCESS) {
accountContacts(
where: { accountId: { eq: $accountId } }
orderBy: [{ createdAt: ASC }]
) {
id
accountId
name
email
phoneNumber
role
createdAt
updatedAt
}
}

query GetAccountContactById($accountId: UUID!, $contactId: UUID!)
@auth(level: NO_ACCESS) {
accountContact(
first: {
where: { id: { eq: $contactId }, accountId: { eq: $accountId } }
}
) {
id
accountId
name
email
phoneNumber
role
createdAt
updatedAt
}
}
92 changes: 0 additions & 92 deletions data/connectors/example/mutations.gql
Original file line number Diff line number Diff line change
Expand Up @@ -76,98 +76,6 @@ mutation DeleteProject($id: UUID!) @auth(level: NO_ACCESS) {
project_delete(id: $id)
}

mutation CreateAccount(
$id: UUID!
$ownerId: String!
$companyName: String!
$businessNumber: String
$phoneNumber: String
) @auth(level: NO_ACCESS) {
account_insert(
data: {
id: $id
ownerId: $ownerId
companyName: $companyName
businessNumber: $businessNumber
phoneNumber: $phoneNumber
createdAt_expr: "request.time"
updatedAt_expr: "request.time"
}
)
}

mutation UpdateAccount(
$id: UUID!
$companyName: String
$businessNumber: String
$phoneNumber: String
$primaryContactId: UUID
) @auth(level: NO_ACCESS) {
account_update(
id: $id
data: {
companyName: $companyName
businessNumber: $businessNumber
phoneNumber: $phoneNumber
primaryContactId: $primaryContactId
updatedAt_expr: "request.time"
}
)
}

mutation DeleteAccountContacts($accountId: UUID!) @auth(level: NO_ACCESS) {
accountContact_deleteMany(where: { accountId: { eq: $accountId } })
}

mutation DeleteAccount($id: UUID!) @auth(level: NO_ACCESS) {
account_delete(id: $id)
}

mutation CreateAccountContact(
$id: UUID!
$accountId: UUID!
$name: String!
$email: String
$phoneNumber: String
$role: String
) @auth(level: NO_ACCESS) {
accountContact_insert(
data: {
id: $id
accountId: $accountId
name: $name
email: $email
phoneNumber: $phoneNumber
role: $role
createdAt_expr: "request.time"
updatedAt_expr: "request.time"
}
)
}

mutation UpdateAccountContact(
$id: UUID!
$name: String
$email: String
$phoneNumber: String
$role: String
) @auth(level: NO_ACCESS) {
accountContact_update(
id: $id
data: {
name: $name
email: $email
phoneNumber: $phoneNumber
role: $role
updatedAt_expr: "request.time"
}
)
}

mutation DeleteAccountContact($id: UUID!) @auth(level: NO_ACCESS) {
accountContact_delete(id: $id)
}

mutation UpsertUserSettings(
$ownerId: String!
$quoteFollowUpEnabled: Boolean!
Expand Down
74 changes: 0 additions & 74 deletions data/connectors/example/queries.gql
Original file line number Diff line number Diff line change
Expand Up @@ -151,80 +151,6 @@ query GetFloorplanPageById($projectId: UUID!, $pageId: UUID!)
}
}

query ListAccountsByOwner($ownerId: String!) @auth(level: NO_ACCESS) {
accounts(
where: { ownerId: { eq: $ownerId } }
orderBy: [{ updatedAt: DESC }]
) {
id
ownerId
companyName
businessNumber
phoneNumber
primaryContactId
createdAt
updatedAt
}
}

query GetAccountById($id: UUID!) @auth(level: NO_ACCESS) {
account(id: $id) {
id
ownerId
companyName
businessNumber
phoneNumber
primaryContactId
createdAt
updatedAt
contacts: accountContacts_on_account(orderBy: [{ createdAt: ASC }]) {
id
accountId
name
email
phoneNumber
role
createdAt
updatedAt
}
}
}

query ListAccountContactsByAccountId($accountId: UUID!)
@auth(level: NO_ACCESS) {
accountContacts(
where: { accountId: { eq: $accountId } }
orderBy: [{ createdAt: ASC }]
) {
id
accountId
name
email
phoneNumber
role
createdAt
updatedAt
}
}

query GetAccountContactById($accountId: UUID!, $contactId: UUID!)
@auth(level: NO_ACCESS) {
accountContact(
first: {
where: { id: { eq: $contactId }, accountId: { eq: $accountId } }
}
) {
id
accountId
name
email
phoneNumber
role
createdAt
updatedAt
}
}

query GetUserSettings($ownerId: String!) @auth(level: NO_ACCESS) {
userSettings(key: { ownerId: $ownerId }) {
ownerId
Expand Down
1 change: 1 addition & 0 deletions dataconnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ schemas:
schemaValidation: "STRICT"
connectorDirs:
- ./data/connectors/example
- ./data/connectors/accounts
- ./data/connectors/questionnaires
1 change: 1 addition & 0 deletions functions/plaster-calculator-functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"logs": "firebase functions:log"
},
"dependencies": {
"@generated/accounts-data-connector-admin": "workspace:*",
"@generated/example-data-connector": "workspace:*",
"firebase-admin": "^13.10.0",
"firebase-functions": "^7.2.5",
Expand Down
Loading
Loading