Rolebase Developers

Organizations

tRPC procedures of the org router: create an organization, change its slug and governance mode, export, import, share and archive it.

Procedures of the org router, which cover the organization-level actions that go beyond editing rows: creating an org with its root circle, moving data in and out, and archiving. Reading and updating the organization itself is plain GraphQL on the org entity.

Mutation org.createOrg

Creates an organization for the signed-in user, who becomes its Owner member, along with a root role and the circle that places it at the top of the org chart. Base roles and meeting templates are seeded later, during in-app onboarding.

InputTypeDescription
nameStringOrganization name. Required.
slugStringURL slug, unique across all organizations. Required.

It returns the id of the new organization. A slug already taken or on the reserved list answers CONFLICT.

const orgId = await trpc.org.createOrg.mutate({ name: 'Acme', slug: 'acme' })

Mutation org.updateOrgSlug

Changes the URL slug of an organization, for an Admin or Owner.

InputTypeDescription
orgIduuidTarget organization. Required.
slugStringNew slug. Required.

Like createOrg, a slug already taken or reserved answers CONFLICT. It returns nothing.

Mutation org.setGovernanceMode

Sets who is allowed to change the org chart. Reserved to the Owner, which is why it is a procedure rather than a GraphQL update: Hasura cannot restrict a single column to Owners while Admins edit the other org settings.

InputTypeDescription
orgIduuidTarget organization. Required.
governanceModegovernance_modeFree, Agile or Strict. Required.

See Permissions for what each mode allows.

await trpc.org.setGovernanceMode.mutate({ orgId, governanceMode: 'Strict' })

Mutation org.exportOrg

Exports the organization data as a JSON or Excel file, for the Owner.

InputTypeDescription
orgIduuidTarget organization. Required.
formatStringjson or xlsx. Required.
entities[String]Optional entities to include, among decisions, tasks, threads and meetings. Required, and may be empty.

Roles, circles and members are always included; the entities list adds the optional ones, with their related rows (thread activities, meeting steps and attendees, and so on). It returns { filename, contentType, data }, where data is the JSON document for json and a base64 workbook for xlsx.

const { filename, data } = await trpc.org.exportOrg.mutate({
orgId,
format: 'xlsx',
entities: ['tasks', 'meetings'],
})

Mutation org.exportOrgChart

Renders the org chart as a PNG image, for any member including Readonly.

InputTypeDescription
orgIduuidTarget organization. Required.
circleIduuidRender this role and its descendants only. Optional, defaults to the whole org chart.
viewStringView to render: AllCircles, SimpleCircles, FlatCircle or Members. Required.
widthIntImage side in pixels, between 100 and 3000. Required.
colorModeStringlight or dark. Optional, defaults to light.
showAllNodesBooleanDraw members and deep circles whatever the zoom scale. Optional.

It returns { data, contentType, filename } with the image as base64.

Mutation org.importOrg

Creates an organization from an uploaded file.

InputTypeDescription
providerStringSource format. Holaspirit is the one currently supported. Required.
fileIduuidId of the file uploaded to storage beforehand. Required.

It returns the id of the created organization. An unreachable file or an unknown provider answers BAD_REQUEST.

Query org.getPublicData

Reads the org chart of an organization that shares it publicly. This procedure takes no authentication.

InputTypeDescription
orgIduuidTarget organization. Required.

It returns { circles, roles, members }, with members empty unless the organization also shares member information. An organization that does not share its org chart answers FORBIDDEN.

Mutation org.archiveOrg

Archives an organization, for the Owner. The Stripe subscription, if any, is deleted first. It takes { orgId } and returns that same id.