Private
Public Access
133 lines
4.9 KiB
Go
133 lines
4.9 KiB
Go
package dto
|
|
|
|
import "time"
|
|
|
|
// EmpresaResponse es la representación pública de una empresa.
|
|
type EmpresaResponse struct {
|
|
ID uint `json:"id"`
|
|
Nombre string `json:"nombre"`
|
|
Slug string `json:"slug"`
|
|
Cuit *string `json:"cuit,omitempty"`
|
|
EmailAlertaStock []string `json:"email_alerta_stock,omitempty"`
|
|
Activa bool `json:"activa"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// EmpresaActualResponse describe la empresa activa de la sesión.
|
|
type EmpresaActualResponse struct {
|
|
ID uint `json:"id"`
|
|
Nombre string `json:"nombre"`
|
|
Slug string `json:"slug"`
|
|
Cuit *string `json:"cuit,omitempty"`
|
|
EmailAlertaStock []string `json:"email_alerta_stock,omitempty"`
|
|
Activa bool `json:"activa"`
|
|
Rol string `json:"rol"`
|
|
MiembrosActivos int64 `json:"miembros_activos"`
|
|
}
|
|
|
|
// EmpresasResponse es el envelope de empresas del usuario.
|
|
type EmpresasResponse struct {
|
|
Empresas []EmpresaResumen `json:"empresas"`
|
|
}
|
|
|
|
// MiembrosListadoResponse conserva las claves usuarios y miembros por
|
|
// compatibilidad con clientes anteriores.
|
|
type MiembrosListadoResponse struct {
|
|
Usuarios []MiembroResponse `json:"usuarios"`
|
|
Miembros []MiembroResponse `json:"miembros"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
|
|
// MiembroCreadoResponse es la respuesta de alta de un miembro.
|
|
type MiembroCreadoResponse struct {
|
|
Usuario MiembroResponse `json:"usuario"`
|
|
PasswordTemporal string `json:"password_temporal"`
|
|
UsuarioExistente bool `json:"usuario_existente"`
|
|
}
|
|
|
|
// InvitacionResponse es la representación pública de una invitación.
|
|
type InvitacionResponse struct {
|
|
ID uint `json:"id"`
|
|
EmpresaID uint `json:"empresa_id"`
|
|
Email string `json:"email"`
|
|
Rol string `json:"rol"`
|
|
GrupoID uint `json:"grupo_id"`
|
|
ExpiraEn time.Time `json:"expira_en"`
|
|
UsadaEn *time.Time `json:"usada_en,omitempty"`
|
|
CreadaPor uint `json:"creada_por"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// InvitacionesResponse es el envelope de invitaciones de una empresa.
|
|
type InvitacionesResponse struct {
|
|
Invitaciones []InvitacionResponse `json:"invitaciones"`
|
|
}
|
|
|
|
// InvitacionAceptadaResponse es la respuesta mínima cuando no se puede
|
|
// construir una sesión completa al aceptar una invitación.
|
|
type InvitacionAceptadaResponse struct {
|
|
Message string `json:"message"`
|
|
UsuarioID uint `json:"usuario_id"`
|
|
EmpresaID uint `json:"empresa_id"`
|
|
}
|
|
|
|
// InvitacionCreadaResponse Agrega los datos de entrega al alta de invitación.
|
|
type InvitacionCreadaResponse struct {
|
|
Invitacion InvitacionResponse `json:"invitacion"`
|
|
Token string `json:"token"`
|
|
Link string `json:"link"`
|
|
EmailEnviado bool `json:"email_enviado"`
|
|
ExpiraEn time.Time `json:"expira_en"`
|
|
}
|
|
|
|
// EmpresaAdminResponse es la vista de empresa para plataforma.
|
|
type EmpresaAdminResponse struct {
|
|
ID uint `json:"id"`
|
|
Nombre string `json:"nombre"`
|
|
Slug string `json:"slug"`
|
|
Cuit *string `json:"cuit,omitempty"`
|
|
EmailAlertaStock []string `json:"email_alerta_stock,omitempty"`
|
|
Activa bool `json:"activa"`
|
|
Miembros int64 `json:"miembros"`
|
|
Owners int64 `json:"owners"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// EmpresasAdminListadoResponse es el envelope de empresas de plataforma.
|
|
type EmpresasAdminListadoResponse struct {
|
|
Empresas []EmpresaAdminResponse `json:"empresas"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
// EmpresaCreadaResponse es la respuesta de alta de empresa desde plataforma.
|
|
type EmpresaCreadaResponse struct {
|
|
Empresa EmpresaAdminResponse `json:"empresa"`
|
|
Owner MiembroResponse `json:"owner"`
|
|
PasswordTemporal string `json:"password_temporal"`
|
|
OwnerExistente bool `json:"owner_existente"`
|
|
}
|
|
|
|
// UsuarioAdminResponse es la vista global de usuario para plataforma.
|
|
type UsuarioAdminResponse struct {
|
|
ID uint `json:"id"`
|
|
Email string `json:"email"`
|
|
Name string `json:"name"`
|
|
Activo bool `json:"activo"`
|
|
DebeCambiarPassword bool `json:"debe_cambiar_password"`
|
|
Empresas int `json:"empresas"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// UsuariosAdminListadoResponse es el envelope de usuarios de plataforma.
|
|
type UsuariosAdminListadoResponse struct {
|
|
Usuarios []UsuarioAdminResponse `json:"usuarios"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
|
|
// UsuariosListadoResponse es el envelope de usuarios de una empresa.
|
|
type UsuariosListadoResponse struct {
|
|
Usuarios []UsuarioResponse `json:"usuarios"`
|
|
Total int64 `json:"total"`
|
|
}
|