Changes between Version 3 and Version 4 of ERModel


Ignore:
Timestamp:
01/21/25 16:55:29 (5 weeks ago)
Author:
163080
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ERModel

    v3 v4  
    11[[Image(https://develop.finki.ukim.mk/projects/agency-os/raw-attachment/wiki/ERModel/AgencyOS.webp)]]
     2
     3= Entities
     4
     5= 1. Company (Tenant)
     6Represents the company/tenant in the system.
     7
     8Attributes:
     9- company_id: Numeric, primary key.
     10- name: Text, required.
     11- address: Text, optional.
     12- vat: Text, optional.
     13- email: Text, required.
     14- created_at: Date, required.
     15- updated_at: Date, required.
     16
     17= 2. User
     18Represents system users with specific roles.
     19
     20Attributes:
     21- user_id: Numeric, primary key.
     22- name: Text, required.
     23- email: Text, unique, required.
     24- password: Text, required.
     25- role: Enum (Admin, HR, Finance Manager), required.
     26- company_id: Foreign key to Company.
     27- created_at: Date, required.
     28- updated_at: Date, required.
     29
     30= 3. Employee
     31Represents employees managed by the company.
     32
     33Attributes:
     34- employee_id: Numeric, primary key.
     35- name: Text, required.
     36- email: Text, unique, required.
     37- status: Enum (Active, Inactive, Terminated), required.
     38- iban: Text, optional.
     39- cv: Text, optional (file path or URL).
     40- photo: Text, optional (file path or URL).
     41- notes: Text, optional.
     42- project: Text, optional.
     43- company_id: Foreign key to Company.
     44- created_at: Date, required.
     45- updated_at: Date, required.
     46
     47= 4. Candidate
     48Represents candidates applying for roles in the company.
     49
     50Attributes:
     51- candidate_id: Numeric, primary key.
     52- name: Text, required.
     53- email: Text, unique, required.
     54- status: Enum (Applied, Interview, Offered, Rejected), required.
     55- cv: Text, optional (file path or URL).
     56- interview_stage: Text, optional.
     57- notes: Text, optional.
     58- company_id: Foreign key to Company.
     59- created_at: Date, required.
     60- updated_at: Date, required.
     61
     62= 5. Client
     63Represents the clients of the company.
     64
     65Attributes:
     66- client_id: Numeric, primary key.
     67- name: Text, required.
     68- representative: Text, required.
     69- email: Text, unique, required.
     70- phone: Text, optional.
     71- address: Text, optional.
     72- vat: Text, optional.
     73- logo: Text, optional (file path or URL).
     74- company_id: Foreign key to Company.
     75- created_at: Date, required.
     76- updated_at: Date, required.
     77
     78= 6. Invoice
     79Represents financial transactions between the company and its clients.
     80
     81Attributes:
     82- invoice_id: Numeric, primary key.
     83- from: Text, required (company details).
     84- to: Text, required (client details).
     85- issue_date: Date, required.
     86- due_date: Date, required.
     87- notes: Text, optional.
     88- status: Enum (Draft, Pending, Paid, Overdue), required.
     89- company_id: Foreign key to Company.
     90- client_id: Foreign key to Client.
     91- created_at: Date, required.
     92- updated_at: Date, required.
     93
     94= 7. LineItem
     95Represents individual items in an invoice.
     96
     97Attributes:
     98- line_item_id: Numeric, primary key.
     99- description: Text, required.
     100- quantity: Integer, required.
     101- unit_price: Decimal, required.
     102- currency: Text, required.
     103- total: Decimal, required.
     104- invoice_id: Foreign key to Invoice.
     105
     106= 8. EmailTemplate
     107Represents customizable email templates.
     108
     109Attributes:
     110- template_id: Numeric, primary key.
     111- type: Enum (New Invoice, Invoice Overdue, Welcome Employee, etc.), required.
     112- subject: Text, required.
     113- body: Text, required.
     114- company_id: Foreign key to Company.
     115- created_at: Date, required.
     116- updated_at: Date, required.
     117
     118= Relations
     119
     120- Company ↔ User: A company has many users; each user belongs to one company.
     121- Company ↔ Employee: A company has many employees; each employee belongs to one company.
     122- Company ↔ Candidate: A company has many candidates; each candidate belongs to one company.
     123- Company ↔ Client: A company has many clients; each client belongs to one company.
     124- Company ↔ Invoice: A company generates many invoices; each invoice belongs to one company.
     125- Client ↔ Invoice: A client can have many invoices; each invoice is addressed to one client.
     126- Invoice ↔ LineItem: An invoice has multiple line items; each line item belongs to one invoice.
     127- Company ↔ EmailTemplate: A company has multiple email templates; each template belongs to one company.