feat: Introduce structured table definitions in convex/tables for various entities and remove the todos example table.
This commit is contained in:
29
packages/backend/convex/tables/empresas.ts
Normal file
29
packages/backend/convex/tables/empresas.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { defineTable } from 'convex/server';
|
||||
import { v } from 'convex/values';
|
||||
|
||||
export const empresasTable = {
|
||||
empresas: defineTable({
|
||||
razao_social: v.string(),
|
||||
nome_fantasia: v.optional(v.string()),
|
||||
cnpj: v.string(),
|
||||
telefone: v.string(),
|
||||
email: v.string(),
|
||||
descricao: v.optional(v.string()),
|
||||
enderecoId: v.optional(v.id('enderecos')),
|
||||
criadoPor: v.optional(v.id('usuarios'))
|
||||
})
|
||||
.index('by_razao_social', ['razao_social'])
|
||||
.index('by_cnpj', ['cnpj']),
|
||||
|
||||
contatosEmpresa: defineTable({
|
||||
empresaId: v.id('empresas'),
|
||||
nome: v.string(),
|
||||
funcao: v.string(),
|
||||
email: v.string(),
|
||||
telefone: v.string(),
|
||||
adicionadoPor: v.optional(v.id('usuarios')),
|
||||
descricao: v.optional(v.string())
|
||||
})
|
||||
.index('by_empresa', ['empresaId'])
|
||||
.index('by_email', ['email'])
|
||||
};
|
||||
Reference in New Issue
Block a user