29 lines
774 B
TypeScript
29 lines
774 B
TypeScript
import { defineTable } from 'convex/server';
|
|
import { v } from 'convex/values';
|
|
|
|
export const objetosTables = {
|
|
objetos: defineTable({
|
|
nome: v.string(),
|
|
valorEstimado: v.string(),
|
|
tipo: v.union(v.literal('material'), v.literal('servico')),
|
|
codigoEfisco: v.string(),
|
|
codigoCatmat: v.optional(v.string()),
|
|
codigoCatserv: v.optional(v.string()),
|
|
unidade: v.string(),
|
|
criadoPor: v.id('usuarios'),
|
|
criadoEm: v.number()
|
|
})
|
|
.searchIndex('search_nome', { searchField: 'nome' })
|
|
.index('by_nome', ['nome'])
|
|
.index('by_tipo', ['tipo']),
|
|
|
|
acoes: defineTable({
|
|
nome: v.string(),
|
|
tipo: v.union(v.literal('projeto'), v.literal('lei')),
|
|
criadoPor: v.id('usuarios'),
|
|
criadoEm: v.number()
|
|
})
|
|
.index('by_nome', ['nome'])
|
|
.index('by_tipo', ['tipo'])
|
|
};
|