Skip to content

Commit 1c1ee18

Browse files
committed
cm
1 parent a8ec8bf commit 1c1ee18

File tree

2 files changed

+97
-2
lines changed

2 files changed

+97
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
- [8. Team Structure & User Roles](#8-team-structure--user-roles)
1515
- [9. Requirements](#9-requirements)
1616
- [10. Entities and Atributes with Data Types](#10-entities-and-atributes-with-data-types)
17-
- [11. Entities Relational Diagram](images/er-diagram.png)
18-
- [12. Relational Database](docs/relational-database.md)
17+
- [11. Entities Relational Diagram](#11-entities-relational-diagram)
18+
- [12. Relational Database](12#)
1919
- [13. Data Seeding](docs/data-seeding.md)
2020
- [14. SQL Simple Queries](queries/simple-queries.md)
2121
- [15. SQL Advanced Queries](queries/advanced-querias.md)

erdiagram.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
from graphviz import Digraph
2+
3+
# Criar diagrama ER
4+
dot = Digraph("ERD_PortalEmprego", format="png")
5+
dot.attr(rankdir="LR", size="8")
6+
7+
# Definir estilo
8+
node_attr = {"shape": "record", "fontname": "Arial", "fontsize": "10"}
9+
10+
# Tabelas principais
11+
dot.node("user_profiles", """{
12+
user_profiles |
13+
+ id (PK) \\l
14+
+ email (UNIQUE) \\l
15+
+ nome_completo \\l
16+
+ perfil \\l
17+
+ telefone \\l
18+
+ criado_em \\l
19+
+ atualizado_em \\l
20+
}""", **node_attr)
21+
22+
dot.node("candidate_profiles", """{
23+
candidate_profiles |
24+
+ id (PK) \\l
25+
+ id_utilizador (FK) \\l
26+
+ curriculo_url \\l
27+
+ competencias \\l
28+
+ anos_experiencia \\l
29+
+ formacao \\l
30+
+ salario_min/max \\l
31+
+ localizacoes_preferidas \\l
32+
+ linkedin/github/portfolio \\l
33+
}""", **node_attr)
34+
35+
dot.node("company_profiles", """{
36+
company_profiles |
37+
+ id (PK) \\l
38+
+ id_utilizador (FK) \\l
39+
+ nome_empresa \\l
40+
+ descricao_empresa \\l
41+
+ sector_atividade \\l
42+
+ dimensao_empresa \\l
43+
+ numero_contribuinte \\l
44+
+ morada/cidade/pais faturacao \\l
45+
+ stripe_customer_id \\l
46+
}""", **node_attr)
47+
48+
dot.node("jobs", """{
49+
jobs |
50+
+ id (PK) \\l
51+
+ id_empresa (FK) \\l
52+
+ titulo \\l
53+
+ descricao \\l
54+
+ salario_min/max \\l
55+
+ localizacao \\l
56+
+ tipo_contrato \\l
57+
+ estado \\l
58+
+ experiencia_requerida \\l
59+
+ categoria \\l
60+
}""", **node_attr)
61+
62+
dot.node("job_applications", """{
63+
job_applications |
64+
+ id (PK) \\l
65+
+ id_oferta (FK) \\l
66+
+ id_candidato (FK) \\l
67+
+ carta_apresentacao_url \\l
68+
+ curriculo_url \\l
69+
+ estado \\l
70+
}""", **node_attr)
71+
72+
dot.node("payment_history", """{
73+
payment_history |
74+
+ id (PK) \\l
75+
+ id_empresa (FK) \\l
76+
+ stripe_payment_intent_id \\l
77+
+ valor \\l
78+
+ moeda \\l
79+
+ estado \\l
80+
+ metodo_pagamento \\l
81+
+ iva_percentual \\l
82+
+ valor_com_iva \\l
83+
}""", **node_attr)
84+
85+
# Relacionamentos
86+
dot.edge("user_profiles", "candidate_profiles", label="1 - n")
87+
dot.edge("user_profiles", "company_profiles", label="1 - n")
88+
dot.edge("company_profiles", "jobs", label="1 - n")
89+
dot.edge("jobs", "job_applications", label="1 - n")
90+
dot.edge("candidate_profiles", "job_applications", label="1 - n")
91+
dot.edge("company_profiles", "payment_history", label="1 - n")
92+
93+
# Exportar
94+
output_path = "/mnt/data/ERD_PortalEmprego.png"
95+
dot.render(output_path, cleanup=True)

0 commit comments

Comments
 (0)