Entities
1. Company (Tenant)
Represents the company/tenant in the system.
Attributes:
- company_id: Numeric, primary key.
- company_name: Text, required.
- address: Text, optional.
- vat: Text, optional.
- email: Text, required.
- created_at: Date, required.
- updated_at: Date, required.
2. User
Represents system users with specific roles.
Attributes:
- user_id: Numeric, primary key.
- user_name: Text, required.
- user_email: Text, unique, required.
- password: Text, required.
- role: Enum (Admin, HR, Finance Manager), required.
- company_id: Foreign key to Company.
- created_at: Date, required.
- updated_at: Date, required.
3. Employee
Represents employees managed by the company.
Attributes:
- employee_id: Numeric, primary key.
- employee_name: Text, required.
- employee_email: Text, unique, required.
- status: Enum (Active, Inactive, Terminated), required.
- iban: Text, optional.
- cv: Text, optional (file path or URL).
- photo: Text, optional (file path or URL).
- notes: Text, optional.
- project: Text, optional.
- company_id: Foreign key to Company.
- created_at: Date, required.
- updated_at: Date, required.
4. Candidate
Represents candidates applying for roles in the company.
Attributes:
- candidate_id: Numeric, primary key.
- candidate_name: Text, required.
- candidate_email: Text, unique, required.
- status: Enum (Applied, Interview, Offered, Rejected), required.
- cv: Text, optional (file path or URL).
- interview_stage: Text, optional.
- notes: Text, optional.
- company_id: Foreign key to Company.
- created_at: Date, required.
- updated_at: Date, required.
5. Client
Represents the clients of the company.
Attributes:
- client_id: Numeric, primary key.
- client_name: Text, required.
- client_representative: Text, required.
- client_email: Text, unique, required.
- phone: Text, optional.
- address: Text, optional.
- vat: Text, optional.
- logo: Text, optional (file path or URL).
- company_id: Foreign key to Company.
- created_at: Date, required.
- updated_at: Date, required.
6. Invoice
Represents financial transactions between the company and its clients.
Attributes:
- invoice_id: Numeric, primary key.
- from: Text, required (company details).
- to: Text, required (client details).
- issue_date: Date, required.
- due_date: Date, required.
- notes: Text, optional.
- status: Enum (Draft, Pending, Paid, Overdue), required.
- company_id: Foreign key to Company.
- client_id: Foreign key to Client.
- created_at: Date, required.
- updated_at: Date, required.
7. LineItem
Represents individual items in an invoice.
Attributes:
- line_item_id: Numeric, primary key.
- description: Text, required.
- quantity: Integer, required.
- unit_price: Decimal, required.
- currency: Text, required.
- total: Decimal, required.
- invoice_id: Foreign key to Invoice.
8. EmailTemplate
Represents customizable email templates.
Attributes:
- template_id: Numeric, primary key.
- type: Enum (New Invoice, Invoice Overdue, Welcome Employee, etc.), required.
- subject: Text, required.
- body: Text, required.
- company_id: Foreign key to Company.
- created_at: Date, required.
- updated_at: Date, required.
Relations
- Company ↔ User (company_user): A company has many users; each user belongs to one company.
- Company ↔ Employee (company_employee): A company has many employees; each employee belongs to one company.
- Company ↔ Candidate (company_candidate): A company has many candidates; each candidate belongs to one company.
- Company ↔ Client (company_client): A company has many clients; each client belongs to one company.
- Company ↔ Invoice (company_invoice): A company generates many invoices; each invoice belongs to one company.
- Client ↔ Invoice (client_invoice): A client can have many invoices; each invoice is addressed to one client.
- Invoice ↔ LineItem (invoice_lineitem): An invoice has multiple line items; each line item belongs to one invoice.
- Company ↔ EmailTemplate (company_emailtemplate): A company has multiple email templates; each template belongs to one company.
Last modified
2 weeks ago
Last modified on 02/07/25 17:47:44
Attachments (4)
-
AgencyOS.drawio.png
(218.3 KB
) - added by 5 weeks ago.
ERD
- AgencyOS.webp (85.6 KB ) - added by 5 weeks ago.
- AgencyOS (1).webp (94.4 KB ) - added by 2 weeks ago.
- AgencyOS (2).webp (95.4 KB ) - added by 2 weeks ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.