feat: Introduce structured table definitions in convex/tables for various entities and remove the todos example table.
This commit is contained in:
26
packages/backend/convex/tables/times.ts
Normal file
26
packages/backend/convex/tables/times.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineTable } from 'convex/server';
|
||||
import { v } from 'convex/values';
|
||||
|
||||
export const timesTables = {
|
||||
times: defineTable({
|
||||
nome: v.string(),
|
||||
descricao: v.optional(v.string()),
|
||||
gestorId: v.id('usuarios'),
|
||||
gestorSuperiorId: v.optional(v.id('usuarios')),
|
||||
ativo: v.boolean(),
|
||||
cor: v.optional(v.string()) // Cor para identificação visual
|
||||
})
|
||||
.index('by_gestor', ['gestorId'])
|
||||
.index('by_gestor_superior', ['gestorSuperiorId']),
|
||||
|
||||
timesMembros: defineTable({
|
||||
timeId: v.id('times'),
|
||||
funcionarioId: v.id('funcionarios'),
|
||||
dataEntrada: v.number(),
|
||||
dataSaida: v.optional(v.number()),
|
||||
ativo: v.boolean()
|
||||
})
|
||||
.index('by_time', ['timeId'])
|
||||
.index('by_funcionario', ['funcionarioId'])
|
||||
.index('by_time_and_ativo', ['timeId', 'ativo'])
|
||||
};
|
||||
Reference in New Issue
Block a user