Documentation for assists.ts
This file defines several tables and their relationships using drizzle-orm for managing assists and their related entities in a PostgreSQL database.
Tables
assist
The assist table stores information about assists.
| Column | Data Type | Description |
|---|---|---|
| id | serial | Unique identifier for the assist. Primary key. |
| name | text | Name of the assist. |
| slug | text | Slug for the assist. |
| isExternal | boolean | Indicates if the assist is external. Default is false. |
| isAutomated | boolean | Indicates if the assist is automated. Default is false. |
| isApi | boolean | Indicates if the assist is API-based. Default is false. |
| createdAt | timestamp | Timestamp when the assist was created. Default is the current time. |
| updatedAt | timestamp | Timestamp when the assist was last updated. Updates automatically. |
| isActive | boolean | Indicates if the assist is active. Default is true. |
| createdById | text | Identifier of the user who created the assist. References user.id. |
| updatedById | text | Identifier of the user who last updated the assist. References user.id. |
assistOrganization
The assistOrganization table stores the relationship between assists and organizations.
| Column | Data Type | Description |
|---|---|---|
| id | serial | Unique identifier for the relationship. Primary key. |
| organizationId | varchar | Identifier of the organization. References organization.id. |
| assistId | integer | Identifier of the assist. References assist.id. |
| createdAt | timestamp | Timestamp when the relationship was created. Default is the current time. |
| updatedAt | timestamp | Timestamp when the relationship was last updated. Updates automatically. |
| isActive | boolean | Indicates if the relationship is active. Default is true. |
| createdById | text | Identifier of the user who created the relationship. References user.id. |
| updatedById | text | Identifier of the user who last updated the relationship. References user.id. |
assistServiceOrderType
The assistServiceOrderType table stores the relationship between assists and service order types.
| Column | Data Type | Description |
|---|---|---|
| id | serial | Unique identifier for the relationship. Primary key. |
| serviceOrderTypeId | integer | Identifier of the service order type. References serviceOrderTypeLU.id. |
| assistId | integer | Identifier of the assist. References assist.id. |
| createdAt | timestamp | Timestamp when the relationship was created. Default is the current time. |
| updatedAt | timestamp | Timestamp when the relationship was last updated. Updates automatically. |
| isActive | boolean | Indicates if the relationship is active. Default is true. |
| createdById | text | Identifier of the user who created the relationship. References user.id. |
| updatedById | text | Identifier of the user who last updated the relationship. References user.id. |
assistServiceOrderCategory
The assistServiceOrderCategory table stores the relationship between assists and service order categories.
| Column | Data Type | Description |
|---|---|---|
| id | serial | Unique identifier for the relationship. Primary key. |
| serviceOrderCategoryId | integer | Identifier of the service order category. References serviceOrderCategoryLU.id. |
| assistId | integer | Identifier of the assist. References assist.id. |
| createdAt | timestamp | Timestamp when the relationship was created. Default is the current time. |
| updatedAt | timestamp | Timestamp when the relationship was last updated. Updates automatically. |
| isActive | boolean | Indicates if the relationship is active. Default is true. |
| createdById | text | Identifier of the user who created the relationship. References user.id. |
| updatedById | text | Identifier of the user who last updated the relationship. References user.id. |
Relationships
assistRelations
Defines the relationships for the assist table.
organizations: Many-to-many relationship with theassistOrganizationtable.serviceOrderTypes: Many-to-many relationship with theassistServiceOrderTypetable.serviceOrderCategories: Many-to-many relationship with theassistServiceOrderCategorytable.
Schemas
newAssistSchema
Schema for inserting a new assist.
export const newAssistSchema = createInsertSchema(assist)Last updated on