Files
Krow-workspace/backend/dataconnect/docs/dataconnect.mmd
José Salazar 0ce416c81b diagrams
2026-01-13 09:36:31 -05:00

272 lines
5.9 KiB
Plaintext

erDiagram
User {
String id PK
String email
String fullName
Timestamp createdDate
}
Business {
UUID id PK
String userId FK
String businessName
Timestamp createdAt
}
Vendor {
UUID id PK
String userId FK
String companyName
Timestamp createdAt
}
Staff {
UUID id PK
String userId FK
UUID hubId FK
UUID ownerId FK
String fullName
Timestamp createdAt
}
Shift {
UUID id PK
UUID orderId FK
UUID ownerId FK
ShiftStatus status
Timestamp createdAt
}
Order {
UUID id PK
UUID ownerId FK
UUID hubId FK
OrderStatus status
Timestamp createdAt
}
Position {
UUID id PK
UUID orderId FK
UUID roleId FK
UUID ownerId FK
Timestamp createdAt
}
Task {
UUID id PK
UUID ownerId FK
TaskStatus status
Timestamp createdAt
}
Team {
UUID id PK
String ownerId FK
String teamName
Timestamp createdAt
}
TeamMember {
UUID id PK
UUID teamId FK
UUID hubId FK
String memberName
Timestamp createdAt
}
Hub {
UUID id PK
UUID ownerId FK
String name
Timestamp createdAt
}
Account {
UUID id PK
UUID ownerId FK "polymorphic ownerId"
String bank
Timestamp createdAt
}
Document {
UUID id PK
UUID staffId FK
DocumentStatus status
Timestamp createdAt
}
Certificate {
UUID id PK
UUID staffId FK
CertificateStatus status
Timestamp createdAt
}
Contact {
UUID id PK
UUID staffId FK
String name
Timestamp createdAt
}
BenefitsData {
UUID id PK
UUID staffId FK
String title
Timestamp createdAt
}
Course {
UUID id PK
String title
Timestamp createdAt
}
TaxForm {
UUID id PK
UUID staffId FK
TaxFormStatus status
Timestamp createdAt
}
TimeSheet {
UUID id PK
UUID staffId FK
UUID shiftId FK
TimeSheetStatus status
Timestamp createdAt
}
Invoice {
UUID id PK
UUID ownerId FK
InvoiceStatus status
Timestamp createdAt
}
Assignment {
UUID id PK
UUID staffId FK
UUID ownerId FK
AssignmentStatus status
Timestamp createdAt
}
Conversation {
UUID id PK
String subject
Timestamp createdAt
}
Message {
UUID id PK
UUID conversationId FK
String senderId
Timestamp createdAt
}
Role {
UUID id PK
UUID ownerId FK
String name
Timestamp createdAt
}
RecentPayment {
UUID id PK
UUID payedUserId FK
UUID ownerId FK
RecentPaymentStatus status
Timestamp createdAt
}
RequiredDoc {
UUID id PK
UUID ownerId FK
ReqDocumentStatus status
Timestamp createdAt
}
VendorRate {
UUID id PK
UUID vendorId FK
String roleName
Timestamp createdAt
}
Schedule {
UUID id PK
UUID positionId FK
Timestamp createdAt
}
TaskComment {
UUID id PK
UUID taskId FK
String authorName
Timestamp createdAt
}
TeamHub {
UUID id PK
UUID teamId FK
String hubName
Timestamp createdAt
}
Application {
UUID id PK
UUID shiftId FK
UUID staffId FK
ApplicationStatus status
Timestamp createdAt
}
StaffShift {
UUID id PK
UUID staffId FK
UUID shiftId FK
Timestamp createdAt
}
MemberTask {
UUID id PK
UUID teamMemberId FK
UUID taskId FK
Timestamp createdAt
}
StaffCourse {
UUID id PK
UUID staffId FK
UUID courseId FK
Timestamp createdAt
}
User ||--|{ Staff : "has profile"
User ||--|{ Vendor : "can be"
User ||--|{ Business : "can be"
User ||--o{ ActivityLog : "generates"
Business ||--o{ "Order" : "creates"
Business ||--o{ Invoice : "receives"
Business ||--o{ Task : "owns"
Business ||--o{ Hub : "owns"
Business ||--o{ Role : "defines"
Business ||--o{ Shift : "posts"
Business ||--o{ Staff : "employs"
Business ||--o{ Account : "owns"
Vendor ||--o{ VendorRate : "defines"
Vendor ||--o{ Task : "owns"
Vendor ||--o{ Hub : "owns"
Vendor ||--o{ Role : "defines"
Vendor ||--o{ Shift : "posts"
Vendor ||--o{ Staff : "employs"
Vendor ||--o{ Account : "owns"
Staff ||--o{ Document : "has"
Staff ||--o{ Certificate : "holds"
Staff ||--o{ Contact : "has emergency"
Staff ||--o{ BenefitsData : "accrues"
Staff ||--o{ TaxForm : "submits"
Staff ||--o{ TimeSheet : "fills"
Staff ||--o{ Assignment : "receives"
Staff ||--o{ Account : "owns"
Staff ||--o{ RecentPayment : "is paid to"
Staff ||--o{ RequiredDoc : "owns"
Staff ||--o{ Application : "submits"
Hub ||--o{ Staff : "is based at"
Shift ||--o{ TimeSheet : "generates"
Shift ||--o{ Application : "receives"
"Order" ||--o{ Shift : "contains"
"Order" ||--o{ Position : "requires"
Task ||--o{ TaskComment : "has"
Team ||--o{ TeamMember : "has"
Team ||--o{ TeamHub : "operates in"
Conversation ||--o{ Message : "contains"
Position ||--o{ Schedule : "has"
Role ||--o{ Position : "is for"
%% Join Tables
Staff ||--|{ StaffShift : "works"
Shift ||--|{ StaffShift : "is worked by"
Staff ||--|{ StaffCourse : "enrolls in"
Course ||--|{ StaffCourse : "is taken by"
TeamMember ||--|{ MemberTask : "assigned to"
Task ||--|{ MemberTask : "is assigned to"