Skip to content

Commit 09a0a3b

Browse files
committed
feat: adicionar painel admin e fortalecer controle de acesso
- adiciona workspace front_admin com dashboard, usuarios, scrapers, observabilidade, auditoria e permissoes - integra o front_admin ao monorepo, scripts npm, Docker Compose e build multi-stage - cria endpoints administrativos para usuarios, observabilidade e regras de permissoes - adiciona persistencia de regras RBAC e atualiza matriz de permissoes - isola keywords por usuario e propaga userId nos eventos de sincronizacao - adiciona rate limit nas rotas de login e cadastro - atualiza migrations, testes, env examples e configuracoes de build/teste - protege builds Docker contra inclusao de envs e artefatos locais
1 parent 66c4fb4 commit 09a0a3b

210 files changed

Lines changed: 20094 additions & 5892 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cspell/custom-dictionary-workspace.txt

Lines changed: 152 additions & 0 deletions
Large diffs are not rendered by default.

.dockerignore

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ node_modules
33
**/node_modules
44

55
# Build outputs
6+
dist
7+
**/dist
68
frontend/dist
79
backend/output
10+
coverage
11+
**/coverage
812

913
# Go
1014
scraper-go/vendor
@@ -17,5 +21,8 @@ electron
1721

1822
# Misc
1923
.git
20-
coverage
21-
**/*.log
24+
.env
25+
.env.*
26+
**/.env
27+
**/.env.*
28+
**/*.log

backend/.env.example

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ SESSION_SECRET=
1414
# CORS / frontend access (separar por vírgula)
1515
CORS_ALLOWED_ORIGINS=
1616

17+
# Rate limit de autenticação
18+
AUTH_RATE_LIMIT_IP_MAX=20
19+
AUTH_RATE_LIMIT_ACCOUNT_MAX=5
20+
AUTH_RATE_LIMIT_WINDOW_SECONDS=900
21+
1722
# URL do frontend (usada para redirect pos-OAuth)
1823
FRONTEND_URL=http://localhost:5173
1924

@@ -69,4 +74,4 @@ GO_SCRAPER_URL=http://localhost:8081
6974

7075

7176
SCRAPER_URL=http://scraper-go:8081
72-
PROMETHEUS_URL=http://prometheus:9090
77+
PROMETHEUS_URL=http://prometheus:9090

backend/bruno/Auth/Register.bru

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ post {
1212

1313
body:json {
1414
{
15-
"email":"hudsontavares@gmail.com",
15+
"email":"hudson60@gmail.com",
1616
"password": "tavares10",
1717
"name": "Hudson Tavares",
18-
"role":"ADMIN"
18+
"role":"banana"
1919
}
2020
}
2121

backend/drizzle/0005_heavy_la_nuit.sql

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DELETE FROM "keywords";--> statement-breakpoint
2+
DROP INDEX IF EXISTS "keywords_keyword_unique";--> statement-breakpoint
3+
ALTER TABLE "keywords" ADD COLUMN "user_id" uuid NOT NULL;--> statement-breakpoint
4+
ALTER TABLE "keywords" ADD CONSTRAINT "keywords_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
5+
CREATE UNIQUE INDEX "keywords_user_keyword_unique" ON "keywords" USING btree ("user_id","keyword");
File renamed without changes.

backend/drizzle/0006_happy_gateway.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE "permission_rules" (
2+
"resource" varchar(50) NOT NULL,
3+
"action" varchar(50) NOT NULL,
4+
"min_role" "user_role" NOT NULL,
5+
"reason" text,
6+
"updated_at" timestamp DEFAULT now() NOT NULL,
7+
CONSTRAINT "permission_rules_resource_action_pk" PRIMARY KEY("resource","action")
8+
);

backend/drizzle/meta/_journal.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,22 @@
4040
{
4141
"idx": 5,
4242
"version": "7",
43-
"when": 1782974700000,
44-
"tag": "0005_sudden_robbie_robertson",
43+
"when": 1783533600000,
44+
"tag": "0005_keywords_tenant_isolation",
45+
"breakpoints": true
46+
},
47+
{
48+
"idx": 6,
49+
"version": "7",
50+
"when": 1783620000000,
51+
"tag": "0006_audit_logs",
52+
"breakpoints": true
53+
},
54+
{
55+
"idx": 7,
56+
"version": "7",
57+
"when": 1783623600000,
58+
"tag": "0007_permission_rules",
4559
"breakpoints": true
4660
}
4761
]

0 commit comments

Comments
 (0)