feat: Introduce structured table definitions in convex/tables for various entities and remove the todos example table.

This commit is contained in:
2025-12-02 09:55:07 -03:00
parent 1c0bd219b2
commit 05e7f1181d
30 changed files with 2700 additions and 2535 deletions

View File

@@ -0,0 +1,24 @@
import { defineTable } from 'convex/server';
import { v } from 'convex/values';
export const setoresTables = {
// Setores da organização
setores: defineTable({
nome: v.string(),
sigla: v.string(),
criadoPor: v.id('usuarios'),
createdAt: v.number()
})
.index('by_nome', ['nome'])
.index('by_sigla', ['sigla']),
// Relação muitos-para-muitos entre funcionários e setores
funcionarioSetores: defineTable({
funcionarioId: v.id('funcionarios'),
setorId: v.id('setores'),
createdAt: v.number()
})
.index('by_funcionarioId', ['funcionarioId'])
.index('by_setorId', ['setorId'])
.index('by_funcionarioId_and_setorId', ['funcionarioId', 'setorId'])
};