Merge pull request #6 from eduardolopesx03/feature/new-pages-functions

Commit com novs paginas e funcionalidades
This commit is contained in:
Eduardo Lopes 2026-01-09 14:13:12 -03:00 committed by GitHub
commit b3093056a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 5028 additions and 94 deletions

View File

@ -14,7 +14,7 @@ namespace line_gestao_api.Controllers
[HttpGet] [HttpGet]
public async Task<ActionResult<PagedResult<BillingClientListDto>>> GetAll( public async Task<ActionResult<PagedResult<BillingClientListDto>>> GetAll(
[FromQuery] string? tipo = "PF", [FromQuery] string? tipo = null, // PF / PJ / ALL / ""
[FromQuery] string? search = null, [FromQuery] string? search = null,
[FromQuery] string? client = null, [FromQuery] string? client = null,
[FromQuery] int page = 1, [FromQuery] int page = 1,
@ -25,16 +25,21 @@ namespace line_gestao_api.Controllers
page = page < 1 ? 1 : page; page = page < 1 ? 1 : page;
pageSize = pageSize < 1 ? 20 : pageSize; pageSize = pageSize < 1 ? 20 : pageSize;
// ✅ FIX CS8072: calcula FORA do expression tree (sem ?. dentro do Where) var tipoNorm = (tipo ?? "").Trim().ToUpperInvariant();
var t = string.Equals(tipo?.Trim(), "PJ", StringComparison.OrdinalIgnoreCase) ? "PJ" : "PF";
var q = _db.BillingClients.AsNoTracking() var q = _db.BillingClients.AsNoTracking().AsQueryable();
.Where(x => x.Tipo == t);
if (tipoNorm == "PF" || tipoNorm == "PJ")
{
q = q.Where(x => x.Tipo == tipoNorm);
}
if (!string.IsNullOrWhiteSpace(search)) if (!string.IsNullOrWhiteSpace(search))
{ {
var s = search.Trim(); var s = search.Trim();
q = q.Where(x => EF.Functions.ILike(x.Cliente ?? "", $"%{s}%")); q = q.Where(x => EF.Functions.ILike(x.Cliente ?? "", $"%{s}%")
|| EF.Functions.ILike(x.Aparelho ?? "", $"%{s}%")
|| EF.Functions.ILike(x.FormaPagamento ?? "", $"%{s}%"));
} }
if (!string.IsNullOrWhiteSpace(client)) if (!string.IsNullOrWhiteSpace(client))
@ -48,27 +53,44 @@ namespace line_gestao_api.Controllers
var sb = (sortBy ?? "cliente").Trim().ToLowerInvariant(); var sb = (sortBy ?? "cliente").Trim().ToLowerInvariant();
var desc = string.Equals((sortDir ?? "asc").Trim(), "desc", StringComparison.OrdinalIgnoreCase); var desc = string.Equals((sortDir ?? "asc").Trim(), "desc", StringComparison.OrdinalIgnoreCase);
// ✅ Ordenação mais estável (coalesce + ThenBy)
q = sb switch q = sb switch
{ {
"tipo" => desc ? q.OrderByDescending(x => x.Tipo).ThenBy(x => x.Cliente) : q.OrderBy(x => x.Tipo).ThenBy(x => x.Cliente),
"item" => desc ? q.OrderByDescending(x => x.Item) : q.OrderBy(x => x.Item), "item" => desc ? q.OrderByDescending(x => x.Item) : q.OrderBy(x => x.Item),
"qtdlinhas" => desc "qtdlinhas" => desc
? q.OrderByDescending(x => x.QtdLinhas ?? 0).ThenBy(x => x.Cliente) ? q.OrderByDescending(x => x.QtdLinhas ?? 0).ThenBy(x => x.Cliente)
: q.OrderBy(x => x.QtdLinhas ?? 0).ThenBy(x => x.Cliente), : q.OrderBy(x => x.QtdLinhas ?? 0).ThenBy(x => x.Cliente),
"lucro" => desc "franquiavivo" => desc
? q.OrderByDescending(x => x.Lucro ?? 0).ThenBy(x => x.Cliente) ? q.OrderByDescending(x => x.FranquiaVivo ?? 0).ThenBy(x => x.Cliente)
: q.OrderBy(x => x.Lucro ?? 0).ThenBy(x => x.Cliente), : q.OrderBy(x => x.FranquiaVivo ?? 0).ThenBy(x => x.Cliente),
"valorcontratovivo" => desc "valorcontratovivo" => desc
? q.OrderByDescending(x => x.ValorContratoVivo ?? 0).ThenBy(x => x.Cliente) ? q.OrderByDescending(x => x.ValorContratoVivo ?? 0).ThenBy(x => x.Cliente)
: q.OrderBy(x => x.ValorContratoVivo ?? 0).ThenBy(x => x.Cliente), : q.OrderBy(x => x.ValorContratoVivo ?? 0).ThenBy(x => x.Cliente),
"franquialine" => desc
? q.OrderByDescending(x => x.FranquiaLine ?? 0).ThenBy(x => x.Cliente)
: q.OrderBy(x => x.FranquiaLine ?? 0).ThenBy(x => x.Cliente),
"valorcontratoline" => desc "valorcontratoline" => desc
? q.OrderByDescending(x => x.ValorContratoLine ?? 0).ThenBy(x => x.Cliente) ? q.OrderByDescending(x => x.ValorContratoLine ?? 0).ThenBy(x => x.Cliente)
: q.OrderBy(x => x.ValorContratoLine ?? 0).ThenBy(x => x.Cliente), : q.OrderBy(x => x.ValorContratoLine ?? 0).ThenBy(x => x.Cliente),
"lucro" => desc
? q.OrderByDescending(x => x.Lucro ?? 0).ThenBy(x => x.Cliente)
: q.OrderBy(x => x.Lucro ?? 0).ThenBy(x => x.Cliente),
"aparelho" => desc
? q.OrderByDescending(x => x.Aparelho).ThenBy(x => x.Cliente)
: q.OrderBy(x => x.Aparelho).ThenBy(x => x.Cliente),
"formapagamento" => desc
? q.OrderByDescending(x => x.FormaPagamento).ThenBy(x => x.Cliente)
: q.OrderBy(x => x.FormaPagamento).ThenBy(x => x.Cliente),
_ => desc _ => desc
? q.OrderByDescending(x => x.Cliente).ThenBy(x => x.Item) ? q.OrderByDescending(x => x.Cliente).ThenBy(x => x.Item)
: q.OrderBy(x => x.Cliente).ThenBy(x => x.Item) : q.OrderBy(x => x.Cliente).ThenBy(x => x.Item)
@ -104,13 +126,19 @@ namespace line_gestao_api.Controllers
} }
[HttpGet("clients")] [HttpGet("clients")]
public async Task<ActionResult<List<string>>> GetClients([FromQuery] string? tipo = "PF") public async Task<ActionResult<List<string>>> GetClients([FromQuery] string? tipo = null)
{ {
// ✅ FIX CS8072: calcula FORA do expression tree var tipoNorm = (tipo ?? "").Trim().ToUpperInvariant();
var t = string.Equals(tipo?.Trim(), "PJ", StringComparison.OrdinalIgnoreCase) ? "PJ" : "PF";
var clients = await _db.BillingClients.AsNoTracking() var q = _db.BillingClients.AsNoTracking().AsQueryable();
.Where(x => x.Tipo == t && !string.IsNullOrEmpty(x.Cliente))
if (tipoNorm == "PF" || tipoNorm == "PJ")
{
q = q.Where(x => x.Tipo == tipoNorm);
}
var clients = await q
.Where(x => !string.IsNullOrEmpty(x.Cliente))
.Select(x => x.Cliente!) .Select(x => x.Cliente!)
.Distinct() .Distinct()
.OrderBy(x => x) .OrderBy(x => x)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,181 @@
using line_gestao_api.Data;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Globalization;
namespace line_gestao_api.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class ParcelamentoController : ControllerBase
{
private readonly AppDbContext _db;
public ParcelamentoController(AppDbContext db)
{
_db = db;
}
public class ParcelamentoKpisDto
{
public decimal TotalGeral { get; set; }
public int Linhas { get; set; }
public int Clientes { get; set; }
public string? CompetenciaInicial { get; set; } // yyyy-MM
public string? CompetenciaFinal { get; set; } // yyyy-MM
public string? MesAtual { get; set; } // yyyy-MM
public decimal TotalMesAtual { get; set; }
}
public class ParcelamentoMonthlyTotalDto
{
public string Competencia { get; set; } = ""; // yyyy-MM
public decimal Total { get; set; }
}
public class ParcelamentoMonthDetailDto
{
public string? Linha { get; set; }
public string? Cliente { get; set; }
public decimal Valor { get; set; }
}
// =========================
// Clientes (dropdown)
// =========================
[HttpGet("clientes")]
public async Task<ActionResult<List<string>>> GetClientes()
{
var clientes = await _db.ParcelamentoLines.AsNoTracking()
.Where(x => x.Cliente != null && x.Cliente != "")
.Select(x => x.Cliente!)
.Distinct()
.OrderBy(x => x)
.ToListAsync();
return Ok(clientes);
}
// =========================
// KPIs
// =========================
[HttpGet("kpis")]
public async Task<ActionResult<ParcelamentoKpisDto>> GetKpis([FromQuery] string? cliente)
{
var qLines = _db.ParcelamentoLines.AsNoTracking();
if (!string.IsNullOrWhiteSpace(cliente))
qLines = qLines.Where(x => x.Cliente == cliente);
var qMeses = _db.ParcelamentoMonthValues.AsNoTracking()
.Join(qLines, m => m.ParcelamentoLineId, l => l.Id, (m, l) => m);
var totalGeral = await qMeses.SumAsync(x => (decimal?)x.Valor) ?? 0m;
var linhas = await qLines.CountAsync();
var clientes = await qLines
.Where(x => x.Cliente != null && x.Cliente != "")
.Select(x => x.Cliente!)
.Distinct()
.CountAsync();
var minComp = await qMeses.MinAsync(x => (DateTime?)x.Competencia);
var maxComp = await qMeses.MaxAsync(x => (DateTime?)x.Competencia);
var now = DateTime.Now;
var mesAtual = new DateTime(now.Year, now.Month, 1);
var totalMesAtual = await qMeses
.Where(x => x.Competencia == mesAtual)
.SumAsync(x => (decimal?)x.Valor) ?? 0m;
return Ok(new ParcelamentoKpisDto
{
TotalGeral = totalGeral,
Linhas = linhas,
Clientes = clientes,
CompetenciaInicial = minComp?.ToString("yyyy-MM"),
CompetenciaFinal = maxComp?.ToString("yyyy-MM"),
MesAtual = mesAtual.ToString("yyyy-MM"),
TotalMesAtual = totalMesAtual
});
}
// =========================
// Série mensal (gráfico)
// =========================
[HttpGet("monthly")]
public async Task<ActionResult<List<ParcelamentoMonthlyTotalDto>>> GetMonthlyTotals(
[FromQuery] string? cliente,
[FromQuery] string? from, // yyyy-MM
[FromQuery] string? to // yyyy-MM
)
{
var qLines = _db.ParcelamentoLines.AsNoTracking();
if (!string.IsNullOrWhiteSpace(cliente))
qLines = qLines.Where(x => x.Cliente == cliente);
var qMeses = _db.ParcelamentoMonthValues.AsNoTracking()
.Join(qLines, m => m.ParcelamentoLineId, l => l.Id, (m, l) => m);
if (TryParseYm(from, out var fromDt))
qMeses = qMeses.Where(x => x.Competencia >= fromDt);
if (TryParseYm(to, out var toDt))
qMeses = qMeses.Where(x => x.Competencia <= toDt);
var data = await qMeses
.GroupBy(x => x.Competencia)
.OrderBy(g => g.Key)
.Select(g => new ParcelamentoMonthlyTotalDto
{
Competencia = g.Key.ToString("yyyy-MM"),
Total = g.Sum(x => x.Valor)
})
.ToListAsync();
return Ok(data);
}
// =========================
// Detalhe do mês (clique no gráfico)
// =========================
[HttpGet("month-details")]
public async Task<ActionResult<List<ParcelamentoMonthDetailDto>>> GetMonthDetails(
[FromQuery] string competencia, // yyyy-MM
[FromQuery] string? cliente
)
{
if (!TryParseYm(competencia, out var comp))
return BadRequest("competencia inválida. Use yyyy-MM (ex.: 2026-01).");
var qLines = _db.ParcelamentoLines.AsNoTracking();
if (!string.IsNullOrWhiteSpace(cliente))
qLines = qLines.Where(x => x.Cliente == cliente);
var data = await _db.ParcelamentoMonthValues.AsNoTracking()
.Where(x => x.Competencia == comp)
.Join(qLines, m => m.ParcelamentoLineId, l => l.Id, (m, l) => new ParcelamentoMonthDetailDto
{
Linha = l.Linha,
Cliente = l.Cliente,
Valor = m.Valor
})
.OrderByDescending(x => x.Valor)
.Take(200)
.ToListAsync();
return Ok(data);
}
// =========================
// Helpers
// =========================
private static bool TryParseYm(string? ym, out DateTime dt)
{
dt = default;
if (string.IsNullOrWhiteSpace(ym)) return false;
return DateTime.TryParseExact(ym.Trim(), "yyyy-MM", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt);
}
}
}

View File

@ -0,0 +1,202 @@
using line_gestao_api.Data;
using line_gestao_api.Dtos;
using line_gestao_api.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Globalization;
using System.Text;
namespace line_gestao_api.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class TrocaNumeroController : ControllerBase
{
private readonly AppDbContext _db;
public TrocaNumeroController(AppDbContext db)
{
_db = db;
}
// ==========================================================
// ✅ GET LIST (PAGINADO)
// ==========================================================
[HttpGet]
public async Task<ActionResult<PagedResult<TrocaNumeroListDto>>> GetAll(
[FromQuery] string? search,
[FromQuery] int page = 1,
[FromQuery] int pageSize = 20,
[FromQuery] string? sortBy = "item",
[FromQuery] string? sortDir = "asc")
{
page = page < 1 ? 1 : page;
pageSize = pageSize < 1 ? 20 : pageSize;
var q = _db.TrocaNumeroLines.AsNoTracking();
if (!string.IsNullOrWhiteSpace(search))
{
var s = search.Trim();
q = q.Where(x =>
EF.Functions.ILike(x.LinhaAntiga ?? "", $"%{s}%") ||
EF.Functions.ILike(x.LinhaNova ?? "", $"%{s}%") ||
EF.Functions.ILike(x.ICCID ?? "", $"%{s}%") ||
EF.Functions.ILike(x.Motivo ?? "", $"%{s}%") ||
EF.Functions.ILike(x.Observacao ?? "", $"%{s}%"));
}
var total = await q.CountAsync();
var sb = (sortBy ?? "item").Trim().ToLowerInvariant();
var desc = string.Equals((sortDir ?? "asc").Trim(), "desc", StringComparison.OrdinalIgnoreCase);
q = sb switch
{
"item" => desc ? q.OrderByDescending(x => x.Item) : q.OrderBy(x => x.Item),
"linhanova" => desc ? q.OrderByDescending(x => x.LinhaNova ?? "").ThenBy(x => x.Item) : q.OrderBy(x => x.LinhaNova ?? "").ThenBy(x => x.Item),
"linhaantiga" => desc ? q.OrderByDescending(x => x.LinhaAntiga ?? "").ThenBy(x => x.Item) : q.OrderBy(x => x.LinhaAntiga ?? "").ThenBy(x => x.Item),
"iccid" => desc ? q.OrderByDescending(x => x.ICCID ?? "").ThenBy(x => x.Item) : q.OrderBy(x => x.ICCID ?? "").ThenBy(x => x.Item),
"datatroca" => desc ? q.OrderByDescending(x => x.DataTroca).ThenBy(x => x.Item) : q.OrderBy(x => x.DataTroca).ThenBy(x => x.Item),
"motivo" => desc ? q.OrderByDescending(x => x.Motivo ?? "").ThenBy(x => x.Item) : q.OrderBy(x => x.Motivo ?? "").ThenBy(x => x.Item),
_ => desc ? q.OrderByDescending(x => x.Item) : q.OrderBy(x => x.Item)
};
var items = await q
.Skip((page - 1) * pageSize)
.Take(pageSize)
.Select(x => new TrocaNumeroListDto
{
Id = x.Id,
Item = x.Item,
LinhaAntiga = x.LinhaAntiga,
LinhaNova = x.LinhaNova,
ICCID = x.ICCID,
DataTroca = x.DataTroca,
Motivo = x.Motivo,
Observacao = x.Observacao
})
.ToListAsync();
return Ok(new PagedResult<TrocaNumeroListDto>
{
Page = page,
PageSize = pageSize,
Total = total,
Items = items
});
}
// ==========================================================
// ✅ GET BY ID
// ==========================================================
[HttpGet("{id:guid}")]
public async Task<ActionResult<TrocaNumeroDetailDto>> GetById(Guid id)
{
var x = await _db.TrocaNumeroLines.AsNoTracking().FirstOrDefaultAsync(a => a.Id == id);
if (x == null) return NotFound();
return Ok(ToDetailDto(x));
}
// ==========================================================
// ✅ CREATE
// ==========================================================
[HttpPost]
public async Task<ActionResult<TrocaNumeroDetailDto>> Create([FromBody] CreateTrocaNumeroDto req)
{
var now = DateTime.UtcNow;
var e = new TrocaNumeroLine
{
Id = Guid.NewGuid(),
Item = req.Item ?? 0,
LinhaAntiga = OnlyDigits(req.LinhaAntiga),
LinhaNova = OnlyDigits(req.LinhaNova),
ICCID = OnlyDigits(req.ICCID),
DataTroca = ToUtc(req.DataTroca),
Motivo = string.IsNullOrWhiteSpace(req.Motivo) ? null : req.Motivo.Trim(),
Observacao = string.IsNullOrWhiteSpace(req.Observacao) ? null : req.Observacao.Trim(),
CreatedAt = now,
UpdatedAt = now
};
_db.TrocaNumeroLines.Add(e);
await _db.SaveChangesAsync();
return CreatedAtAction(nameof(GetById), new { id = e.Id }, ToDetailDto(e));
}
// ==========================================================
// ✅ UPDATE
// ==========================================================
[HttpPut("{id:guid}")]
public async Task<IActionResult> Update(Guid id, [FromBody] UpdateTrocaNumeroRequest req)
{
var x = await _db.TrocaNumeroLines.FirstOrDefaultAsync(a => a.Id == id);
if (x == null) return NotFound();
if (req.Item.HasValue) x.Item = req.Item.Value;
x.LinhaAntiga = OnlyDigits(req.LinhaAntiga);
x.LinhaNova = OnlyDigits(req.LinhaNova);
x.ICCID = OnlyDigits(req.ICCID);
x.DataTroca = ToUtc(req.DataTroca);
x.Motivo = string.IsNullOrWhiteSpace(req.Motivo) ? null : req.Motivo.Trim();
x.Observacao = string.IsNullOrWhiteSpace(req.Observacao) ? null : req.Observacao.Trim();
x.UpdatedAt = DateTime.UtcNow;
await _db.SaveChangesAsync();
return NoContent();
}
// ==========================================================
// ✅ DELETE
// ==========================================================
[HttpDelete("{id:guid}")]
public async Task<IActionResult> Delete(Guid id)
{
var x = await _db.TrocaNumeroLines.FirstOrDefaultAsync(a => a.Id == id);
if (x == null) return NotFound();
_db.TrocaNumeroLines.Remove(x);
await _db.SaveChangesAsync();
return NoContent();
}
// ==========================================================
// HELPERS
// ==========================================================
private static TrocaNumeroDetailDto ToDetailDto(TrocaNumeroLine x) => new()
{
Id = x.Id,
Item = x.Item,
LinhaAntiga = x.LinhaAntiga,
LinhaNova = x.LinhaNova,
ICCID = x.ICCID,
DataTroca = x.DataTroca,
Motivo = x.Motivo,
Observacao = x.Observacao,
CreatedAt = x.CreatedAt,
UpdatedAt = x.UpdatedAt
};
private static DateTime? ToUtc(DateTime? dt)
{
if (dt == null) return null;
var v = dt.Value;
return v.Kind == DateTimeKind.Utc ? v :
(v.Kind == DateTimeKind.Local ? v.ToUniversalTime() : DateTime.SpecifyKind(v, DateTimeKind.Utc));
}
private static string OnlyDigits(string? s)
{
if (string.IsNullOrWhiteSpace(s)) return "";
var sb = new StringBuilder();
foreach (var c in s) if (char.IsDigit(c)) sb.Append(c);
return sb.ToString();
}
}
}

View File

@ -0,0 +1,193 @@
using line_gestao_api.Data;
using line_gestao_api.Dtos;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace line_gestao_api.Controllers
{
[ApiController]
[Route("api/user-data")]
public class UserDataController : ControllerBase
{
private readonly AppDbContext _db;
public UserDataController(AppDbContext db) => _db = db;
// ==========================================================
// GET /api/user-data (LINHAS - Tabela Interna)
// ==========================================================
[HttpGet]
public async Task<ActionResult<PagedResult<UserDataListDto>>> GetAll(
[FromQuery] string? search,
[FromQuery] string? client, // Filtro por cliente
[FromQuery] int page = 1,
[FromQuery] int pageSize = 20,
[FromQuery] string? sortBy = "item",
[FromQuery] string? sortDir = "asc")
{
page = page < 1 ? 1 : page;
pageSize = pageSize < 1 ? 20 : pageSize;
var q = _db.UserDatas.AsNoTracking();
// Filtro exato por cliente (quando abre o card)
if (!string.IsNullOrWhiteSpace(client))
{
var c = client.Trim();
q = q.Where(x => x.Cliente == c);
}
// Busca global
if (!string.IsNullOrWhiteSpace(search))
{
var s = search.Trim();
q = q.Where(x =>
EF.Functions.ILike(x.Linha ?? "", $"%{s}%") ||
EF.Functions.ILike(x.Cliente ?? "", $"%{s}%") ||
EF.Functions.ILike(x.Cpf ?? "", $"%{s}%") ||
EF.Functions.ILike(x.Email ?? "", $"%{s}%") ||
EF.Functions.ILike(x.Celular ?? "", $"%{s}%"));
}
var total = await q.CountAsync();
var sb = (sortBy ?? "item").Trim().ToLowerInvariant();
var desc = string.Equals((sortDir ?? "asc").Trim(), "desc", StringComparison.OrdinalIgnoreCase);
q = sb switch
{
"item" => desc ? q.OrderByDescending(x => x.Item) : q.OrderBy(x => x.Item),
"linha" => desc ? q.OrderByDescending(x => x.Linha) : q.OrderBy(x => x.Linha),
"cliente" => desc ? q.OrderByDescending(x => x.Cliente) : q.OrderBy(x => x.Cliente),
_ => desc ? q.OrderByDescending(x => x.Item) : q.OrderBy(x => x.Item),
};
var items = await q
.Skip((page - 1) * pageSize)
.Take(pageSize)
.Select(x => new UserDataListDto
{
Id = x.Id,
Item = x.Item,
Linha = x.Linha,
Cliente = x.Cliente,
Cpf = x.Cpf,
Rg = x.Rg,
DataNascimento = x.DataNascimento != null ? x.DataNascimento.Value.ToString("yyyy-MM-dd") : null,
Email = x.Email,
Endereco = x.Endereco,
Celular = x.Celular,
TelefoneFixo = x.TelefoneFixo
})
.ToListAsync();
return Ok(new PagedResult<UserDataListDto>
{
Page = page,
PageSize = pageSize,
Total = total,
Items = items
});
}
// ==========================================================
// GET /api/user-data/groups (CARDS + KPIs GERAIS)
// ==========================================================
[HttpGet("groups")]
public async Task<ActionResult<UserDataGroupResponse>> GetGroups(
[FromQuery] string? search,
[FromQuery] int page = 1,
[FromQuery] int pageSize = 10,
[FromQuery] string? sortBy = "cliente",
[FromQuery] string? sortDir = "asc")
{
page = page < 1 ? 1 : page;
pageSize = pageSize < 1 ? 10 : pageSize;
var q = _db.UserDatas.AsNoTracking()
.Where(x => x.Cliente != null && x.Cliente != "");
if (!string.IsNullOrWhiteSpace(search))
{
var s = search.Trim();
q = q.Where(x => EF.Functions.ILike(x.Cliente ?? "", $"%{s}%"));
}
// ✅ 1. CÁLCULO DOS KPIS GERAIS (Baseado em todos os dados filtrados, sem paginação)
var kpis = new UserDataKpisDto
{
TotalRegistros = await q.CountAsync(),
ClientesUnicos = await q.Select(x => x.Cliente).Distinct().CountAsync(),
ComCpf = await q.CountAsync(x => x.Cpf != null && x.Cpf != ""),
ComEmail = await q.CountAsync(x => x.Email != null && x.Email != "")
};
// ✅ 2. AGRUPAMENTO (Para os Cards)
var grouped = q
.GroupBy(x => x.Cliente!)
.Select(g => new UserDataClientGroupDto
{
Cliente = g.Key,
TotalRegistros = g.Count(),
ComCpf = g.Count(x => x.Cpf != null && x.Cpf != ""),
ComEmail = g.Count(x => x.Email != null && x.Email != "")
});
var totalGroups = await grouped.CountAsync();
// Ordenação
var desc = string.Equals((sortDir ?? "asc").Trim(), "desc", StringComparison.OrdinalIgnoreCase);
grouped = desc ? grouped.OrderByDescending(x => x.Cliente) : grouped.OrderBy(x => x.Cliente);
// Paginação dos Grupos
var items = await grouped
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
return Ok(new UserDataGroupResponse
{
Data = new PagedResult<UserDataClientGroupDto>
{
Page = page,
PageSize = pageSize,
Total = totalGroups, // Total de Clientes
Items = items
},
Kpis = kpis // KPIs Totais
});
}
[HttpGet("clients")]
public async Task<ActionResult<List<string>>> GetClients()
{
return await _db.UserDatas.AsNoTracking()
.Where(x => !string.IsNullOrEmpty(x.Cliente))
.Select(x => x.Cliente!)
.Distinct()
.OrderBy(x => x)
.ToListAsync();
}
[HttpGet("{id:guid}")]
public async Task<ActionResult<UserDataDetailDto>> GetById(Guid id)
{
var x = await _db.UserDatas.AsNoTracking().FirstOrDefaultAsync(a => a.Id == id);
if (x == null) return NotFound();
return Ok(new UserDataDetailDto
{
Id = x.Id,
Item = x.Item,
Linha = x.Linha,
Cliente = x.Cliente,
Cpf = x.Cpf,
Rg = x.Rg,
Email = x.Email,
Celular = x.Celular,
Endereco = x.Endereco,
TelefoneFixo = x.TelefoneFixo,
DataNascimento = x.DataNascimento
});
}
}
}

View File

@ -0,0 +1,185 @@
using line_gestao_api.Data;
using line_gestao_api.Dtos;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace line_gestao_api.Controllers
{
[ApiController]
[Route("api/lines/vigencia")]
public class VigenciaController : ControllerBase
{
private readonly AppDbContext _db;
public VigenciaController(AppDbContext db)
{
_db = db;
}
// GET /api/lines/vigencia (Linhas - Tabela Interna)
[HttpGet]
public async Task<ActionResult<PagedResult<VigenciaLineListDto>>> GetVigencia(
[FromQuery] string? search,
[FromQuery] string? client,
[FromQuery] int page = 1,
[FromQuery] int pageSize = 20,
[FromQuery] string? sortBy = "item",
[FromQuery] string? sortDir = "asc")
{
page = page < 1 ? 1 : page;
pageSize = pageSize < 1 ? 20 : pageSize;
var q = _db.VigenciaLines.AsNoTracking();
if (!string.IsNullOrWhiteSpace(client))
{
var c = client.Trim();
q = q.Where(x => x.Cliente == c);
}
if (!string.IsNullOrWhiteSpace(search))
{
var s = search.Trim();
q = q.Where(x =>
EF.Functions.ILike(x.Conta ?? "", $"%{s}%") ||
EF.Functions.ILike(x.Linha ?? "", $"%{s}%") ||
EF.Functions.ILike(x.Cliente ?? "", $"%{s}%") ||
EF.Functions.ILike(x.Usuario ?? "", $"%{s}%") ||
EF.Functions.ILike(x.PlanoContrato ?? "", $"%{s}%"));
}
var total = await q.CountAsync();
var sb = (sortBy ?? "item").Trim().ToLowerInvariant();
var desc = string.Equals((sortDir ?? "asc").Trim(), "desc", StringComparison.OrdinalIgnoreCase);
q = sb switch
{
"item" => desc ? q.OrderByDescending(x => x.Item) : q.OrderBy(x => x.Item),
"linha" => desc ? q.OrderByDescending(x => x.Linha) : q.OrderBy(x => x.Linha),
"total" => desc ? q.OrderByDescending(x => x.Total) : q.OrderBy(x => x.Total),
"dttermino" => desc ? q.OrderByDescending(x => x.DtTerminoFidelizacao) : q.OrderBy(x => x.DtTerminoFidelizacao),
_ => desc ? q.OrderByDescending(x => x.Item) : q.OrderBy(x => x.Item),
};
var items = await q
.Skip((page - 1) * pageSize)
.Take(pageSize)
.Select(x => new VigenciaLineListDto
{
Id = x.Id,
Item = x.Item,
Conta = x.Conta,
Linha = x.Linha,
Cliente = x.Cliente,
Usuario = x.Usuario,
PlanoContrato = x.PlanoContrato,
DtEfetivacaoServico = x.DtEfetivacaoServico,
DtTerminoFidelizacao = x.DtTerminoFidelizacao,
Total = x.Total
})
.ToListAsync();
return Ok(new PagedResult<VigenciaLineListDto>
{
Page = page,
PageSize = pageSize,
Total = total,
Items = items
});
}
// ==========================================================
// GET /api/lines/vigencia/groups (Cards + KPIs GERAIS)
// ==========================================================
[HttpGet("groups")]
public async Task<ActionResult<VigenciaGroupResponse>> GetVigenciaGroups(
[FromQuery] string? search,
[FromQuery] int page = 1,
[FromQuery] int pageSize = 20,
[FromQuery] string? sortBy = "cliente",
[FromQuery] string? sortDir = "asc")
{
page = page < 1 ? 1 : page;
pageSize = pageSize < 1 ? 20 : pageSize;
var today = DateTime.UtcNow.Date; // UTC para evitar erro no PostgreSQL
var limit30 = today.AddDays(30);
// Query Base (Linhas)
var q = _db.VigenciaLines.AsNoTracking()
.Where(x => x.Cliente != null && x.Cliente != "");
if (!string.IsNullOrWhiteSpace(search))
{
var s = search.Trim();
q = q.Where(x => EF.Functions.ILike(x.Cliente ?? "", $"%{s}%"));
}
// ✅ CÁLCULO DOS KPIS GERAIS (Antes do agrupamento/paginação)
// Isso garante que os KPIs mostrem o total do banco (ou do filtro), não só da página.
var kpis = new VigenciaKpis
{
TotalLinhas = await q.CountAsync(),
// Clientes distintos
TotalClientes = await q.Select(x => x.Cliente).Distinct().CountAsync(),
TotalVencidos = await q.CountAsync(x => x.DtTerminoFidelizacao != null && x.DtTerminoFidelizacao.Value.Date < today),
ValorTotal = await q.SumAsync(x => x.Total ?? 0m)
};
// Agrupamento para a lista paginada
var grouped = q
.GroupBy(x => x.Cliente!)
.Select(g => new VigenciaClientGroupDto
{
Cliente = g.Key,
Linhas = g.Count(),
Total = g.Sum(x => x.Total ?? 0m),
Vencidos = g.Count(x => x.DtTerminoFidelizacao != null && x.DtTerminoFidelizacao.Value.Date < today),
AVencer30 = g.Count(x => x.DtTerminoFidelizacao != null && x.DtTerminoFidelizacao.Value.Date >= today && x.DtTerminoFidelizacao.Value.Date <= limit30),
ProximoVencimento = g.Where(x => x.DtTerminoFidelizacao >= today).Min(x => x.DtTerminoFidelizacao),
UltimoVencimento = g.Where(x => x.DtTerminoFidelizacao < today).Max(x => x.DtTerminoFidelizacao)
});
// Contagem para paginação
var totalGroups = await grouped.CountAsync();
// Ordenação
var desc = string.Equals((sortDir ?? "asc").Trim(), "desc", StringComparison.OrdinalIgnoreCase);
if (sortBy?.ToLower() == "linhas")
grouped = desc ? grouped.OrderByDescending(x => x.Linhas) : grouped.OrderBy(x => x.Linhas);
else
grouped = desc ? grouped.OrderByDescending(x => x.Cliente) : grouped.OrderBy(x => x.Cliente);
// Paginação
var items = await grouped
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
// ✅ Retorna objeto composto
return Ok(new VigenciaGroupResponse
{
Data = new PagedResult<VigenciaClientGroupDto>
{
Page = page,
PageSize = pageSize,
Total = totalGroups, // Total de Clientes na paginação
Items = items
},
Kpis = kpis // KPIs Globais
});
}
[HttpGet("clients")]
public async Task<ActionResult<List<string>>> GetVigenciaClients()
{
return await _db.VigenciaLines.AsNoTracking()
.Where(x => !string.IsNullOrEmpty(x.Cliente))
.Select(x => x.Cliente!)
.Distinct()
.OrderBy(x => x)
.ToListAsync();
}
}
}

View File

@ -18,46 +18,103 @@ public class AppDbContext : DbContext
// ✅ tabela para espelhar o FATURAMENTO (PF/PJ) // ✅ tabela para espelhar o FATURAMENTO (PF/PJ)
public DbSet<BillingClient> BillingClients => Set<BillingClient>(); public DbSet<BillingClient> BillingClients => Set<BillingClient>();
public DbSet<UserData> UserDatas => Set<UserData>();
public DbSet<VigenciaLine> VigenciaLines { get; set; } = default!;
public DbSet<TrocaNumeroLine> TrocaNumeroLines => Set<TrocaNumeroLine>();
// ✅ PARCELAMENTO
public DbSet<ParcelamentoLine> ParcelamentoLines => Set<ParcelamentoLine>();
public DbSet<ParcelamentoMonthValue> ParcelamentoMonthValues => Set<ParcelamentoMonthValue>();
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
base.OnModelCreating(modelBuilder); base.OnModelCreating(modelBuilder);
// ✅ MANTIDO: índice único do User // =========================
// ✅ USER
// =========================
modelBuilder.Entity<User>() modelBuilder.Entity<User>()
.HasIndex(u => u.Email) .HasIndex(u => u.Email)
.IsUnique(); .IsUnique();
// ✅ MANTIDO: índice único para evitar duplicar a mesma linha (telefone) // =========================
// ✅ GERAL (MobileLine)
// =========================
modelBuilder.Entity<MobileLine>() modelBuilder.Entity<MobileLine>()
.HasIndex(x => x.Linha) .HasIndex(x => x.Linha)
.IsUnique(); .IsUnique();
// ✅ MANTIDO: índices do MUREG // =========================
// ✅ MUREG
// =========================
modelBuilder.Entity<MuregLine>().HasIndex(x => x.Item); modelBuilder.Entity<MuregLine>().HasIndex(x => x.Item);
modelBuilder.Entity<MuregLine>().HasIndex(x => x.Cliente); modelBuilder.Entity<MuregLine>().HasIndex(x => x.Cliente);
modelBuilder.Entity<MuregLine>().HasIndex(x => x.ICCID); modelBuilder.Entity<MuregLine>().HasIndex(x => x.ICCID);
modelBuilder.Entity<MuregLine>().HasIndex(x => x.LinhaNova); modelBuilder.Entity<MuregLine>().HasIndex(x => x.LinhaNova);
// ========================================================== // ==========================================================
// ✅ NOVO: MAPEAMENTO DO FATURAMENTO // ✅ FATURAMENTO (BillingClient) - mantém seu mapeamento
// (evita problema de tabela "BillingClients" vs postgres case)
// ========================================================== // ==========================================================
modelBuilder.Entity<BillingClient>(e => modelBuilder.Entity<BillingClient>(e =>
{ {
// 🔥 Nome físico fixo da tabela no Postgres
e.ToTable("billing_clients"); e.ToTable("billing_clients");
e.HasKey(x => x.Id); e.HasKey(x => x.Id);
// (opcional, mas bom pra padronizar)
e.Property(x => x.Tipo).HasMaxLength(2); e.Property(x => x.Tipo).HasMaxLength(2);
e.Property(x => x.Cliente).HasMaxLength(255); e.Property(x => x.Cliente).HasMaxLength(255);
// índices úteis para filtros/ordenação
e.HasIndex(x => x.Tipo); e.HasIndex(x => x.Tipo);
e.HasIndex(x => x.Cliente); e.HasIndex(x => x.Cliente);
e.HasIndex(x => new { x.Tipo, x.Cliente }); e.HasIndex(x => new { x.Tipo, x.Cliente });
e.HasIndex(x => x.Item); e.HasIndex(x => x.Item);
}); });
// ==========================================================
// ✅ PARCELAMENTO - MAPEAMENTO COMPLETO
// ==========================================================
modelBuilder.Entity<ParcelamentoLine>(e =>
{
// Nome físico fixo no Postgres
e.ToTable("parcelamento_lines");
e.HasKey(x => x.Id);
e.Property(x => x.Linha).HasMaxLength(32);
e.Property(x => x.Cliente).HasMaxLength(120);
e.Property(x => x.QtParcelas).HasMaxLength(32);
// índices úteis para filtro e performance
e.HasIndex(x => x.Cliente);
e.HasIndex(x => x.Linha);
e.HasIndex(x => x.AnoRef);
// se você quiser evitar duplicar importação da mesma linha/cliente/item:
// (deixa comentado pra não quebrar caso existam repetições legítimas)
// e.HasIndex(x => new { x.AnoRef, x.Item, x.Linha, x.Cliente }).IsUnique();
});
modelBuilder.Entity<ParcelamentoMonthValue>(e =>
{
e.ToTable("parcelamento_month_values");
e.HasKey(x => x.Id);
// relação 1:N (ParcelamentoLine -> Meses)
e.HasOne(x => x.ParcelamentoLine)
.WithMany(x => x.Meses)
.HasForeignKey(x => x.ParcelamentoLineId)
.OnDelete(DeleteBehavior.Cascade);
// índices para gráfico e consultas por mês
e.HasIndex(x => x.Competencia);
e.HasIndex(x => x.ParcelamentoLineId);
// garante 1 valor por mês por linha (evita duplicar mês)
e.HasIndex(x => new { x.ParcelamentoLineId, x.Competencia })
.IsUnique();
});
} }
} }

View File

@ -0,0 +1,15 @@
namespace line_gestao_api.Dtos
{
public class ParcelamentoKpisDto
{
public decimal TotalGeral { get; set; }
public int Linhas { get; set; }
public int Clientes { get; set; }
public string? CompetenciaInicial { get; set; } // "2025-12"
public string? CompetenciaFinal { get; set; } // "2027-06"
public string? MesAtual { get; set; } // "2026-01"
public decimal TotalMesAtual { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace line_gestao_api.Dtos
{
public class ParcelamentoMonthDetailDto
{
public string? Linha { get; set; }
public string? Cliente { get; set; }
public decimal Valor { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace line_gestao_api.Dtos
{
public class ParcelamentoMonthlyTotalDto
{
public string Competencia { get; set; } = ""; // "2026-01"
public decimal Total { get; set; }
}
}

37
Dtos/TrocaNumeroDtos.cs Normal file
View File

@ -0,0 +1,37 @@
using System;
namespace line_gestao_api.Dtos
{
public class TrocaNumeroListDto
{
public Guid Id { get; set; }
public int Item { get; set; }
public string? LinhaAntiga { get; set; }
public string? LinhaNova { get; set; }
public string? ICCID { get; set; }
public DateTime? DataTroca { get; set; }
public string? Motivo { get; set; }
public string? Observacao { get; set; }
}
public class TrocaNumeroDetailDto : TrocaNumeroListDto
{
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
public class CreateTrocaNumeroDto
{
public int? Item { get; set; }
public string? LinhaAntiga { get; set; }
public string? LinhaNova { get; set; }
public string? ICCID { get; set; }
public DateTime? DataTroca { get; set; }
public string? Motivo { get; set; }
public string? Observacao { get; set; }
}
public class UpdateTrocaNumeroRequest : CreateTrocaNumeroDto
{
}
}

58
Dtos/UserDataDtos.cs Normal file
View File

@ -0,0 +1,58 @@
using System;
namespace line_gestao_api.Dtos
{
public class UserDataListDto
{
public Guid Id { get; set; }
public int Item { get; set; }
public string? Linha { get; set; }
public string? Cliente { get; set; }
public string? Cpf { get; set; }
public string? Rg { get; set; }
public string? DataNascimento { get; set; }
public string? Email { get; set; }
public string? Endereco { get; set; }
public string? Celular { get; set; }
public string? TelefoneFixo { get; set; }
}
public class UserDataDetailDto
{
public Guid Id { get; set; }
public int Item { get; set; }
public string? Linha { get; set; }
public string? Cliente { get; set; }
public string? Cpf { get; set; }
public string? Rg { get; set; }
public DateTime? DataNascimento { get; set; }
public string? Email { get; set; }
public string? Endereco { get; set; }
public string? Celular { get; set; }
public string? TelefoneFixo { get; set; }
}
public class UserDataKpisDto
{
public int TotalRegistros { get; set; }
public int ClientesUnicos { get; set; }
public int ComCpf { get; set; }
public int ComEmail { get; set; }
}
// DTO para o Card do Cliente
public class UserDataClientGroupDto
{
public string Cliente { get; set; } = "";
public int TotalRegistros { get; set; }
public int ComCpf { get; set; }
public int ComEmail { get; set; }
}
// ✅ RESPOSTA COMPOSTA (DADOS + KPIS)
public class UserDataGroupResponse
{
public PagedResult<UserDataClientGroupDto> Data { get; set; } = new();
public UserDataKpisDto Kpis { get; set; } = new();
}
}

45
Dtos/VigenciaDtos.cs Normal file
View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
namespace line_gestao_api.Dtos
{
public class VigenciaLineListDto
{
public Guid Id { get; set; }
public int Item { get; set; }
public string? Conta { get; set; }
public string? Linha { get; set; }
public string? Cliente { get; set; }
public string? Usuario { get; set; }
public string? PlanoContrato { get; set; }
public DateTime? DtEfetivacaoServico { get; set; }
public DateTime? DtTerminoFidelizacao { get; set; }
public decimal? Total { get; set; }
}
public class VigenciaClientGroupDto
{
public string Cliente { get; set; } = "";
public int Linhas { get; set; }
public decimal Total { get; set; }
public int Vencidos { get; set; }
public int AVencer30 { get; set; }
public DateTime? ProximoVencimento { get; set; }
public DateTime? UltimoVencimento { get; set; }
}
// ✅ NOVO: Objeto de resposta contendo KPIs + Dados Paginados
public class VigenciaGroupResponse
{
public PagedResult<VigenciaClientGroupDto> Data { get; set; } = new();
public VigenciaKpis Kpis { get; set; } = new();
}
public class VigenciaKpis
{
public int TotalClientes { get; set; }
public int TotalLinhas { get; set; }
public int TotalVencidos { get; set; }
public decimal ValorTotal { get; set; }
}
}

View File

@ -0,0 +1,340 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using line_gestao_api.Data;
#nullable disable
namespace line_gestao_api.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260106195112_AddUserDatas")]
partial class AddUserDatas
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("line_gestao_api.Models.BillingClient", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Aparelho")
.HasColumnType("text");
b.Property<string>("Cliente")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FormaPagamento")
.HasColumnType("text");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<int?>("QtdLinhas")
.HasColumnType("integer");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("character varying(2)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("Item");
b.HasIndex("Tipo");
b.HasIndex("Tipo", "Cliente");
b.ToTable("billing_clients", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.MobileLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cedente")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Chip")
.HasMaxLength(40)
.HasColumnType("character varying(40)");
b.Property<string>("Cliente")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Conta")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataBloqueio")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaCliente")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaOpera")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("Desconto")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaGestao")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<decimal?>("GestaoVozDados")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal?>("LocacaoAp")
.HasColumnType("numeric");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<string>("Modalidade")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("PlanoContrato")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("Skeelo")
.HasColumnType("numeric");
b.Property<string>("Skil")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("Solicitante")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Status")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.Property<decimal?>("ValorPlanoVivo")
.HasColumnType("numeric");
b.Property<string>("VencConta")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<decimal?>("VivoGestaoDispositivo")
.HasColumnType("numeric");
b.Property<decimal?>("VivoNewsPlus")
.HasColumnType("numeric");
b.Property<decimal?>("VivoTravelMundo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Linha")
.IsUnique();
b.ToTable("MobileLines");
});
modelBuilder.Entity("line_gestao_api.Models.MuregLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataDaMureg")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("ICCID");
b.HasIndex("Item");
b.HasIndex("LinhaNova");
b.ToTable("MuregLines");
});
modelBuilder.Entity("line_gestao_api.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("line_gestao_api.Models.UserData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Celular")
.HasColumnType("text");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Cpf")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataNascimento")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<string>("Endereco")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("Rg")
.HasColumnType("text");
b.Property<string>("TelefoneFixo")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("UserDatas");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace line_gestao_api.Migrations
{
/// <inheritdoc />
public partial class AddUserDatas : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "UserDatas",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Item = table.Column<int>(type: "integer", nullable: false),
Linha = table.Column<string>(type: "text", nullable: true),
Cliente = table.Column<string>(type: "text", nullable: true),
Cpf = table.Column<string>(type: "text", nullable: true),
Rg = table.Column<string>(type: "text", nullable: true),
DataNascimento = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
Email = table.Column<string>(type: "text", nullable: true),
Endereco = table.Column<string>(type: "text", nullable: true),
Celular = table.Column<string>(type: "text", nullable: true),
TelefoneFixo = table.Column<string>(type: "text", nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserDatas", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "UserDatas");
}
}
}

View File

@ -0,0 +1,340 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using line_gestao_api.Data;
#nullable disable
namespace line_gestao_api.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260107134401_AddVigenciaLines")]
partial class AddVigenciaLines
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("line_gestao_api.Models.BillingClient", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Aparelho")
.HasColumnType("text");
b.Property<string>("Cliente")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FormaPagamento")
.HasColumnType("text");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<int?>("QtdLinhas")
.HasColumnType("integer");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("character varying(2)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("Item");
b.HasIndex("Tipo");
b.HasIndex("Tipo", "Cliente");
b.ToTable("billing_clients", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.MobileLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cedente")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Chip")
.HasMaxLength(40)
.HasColumnType("character varying(40)");
b.Property<string>("Cliente")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Conta")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataBloqueio")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaCliente")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaOpera")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("Desconto")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaGestao")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<decimal?>("GestaoVozDados")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal?>("LocacaoAp")
.HasColumnType("numeric");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<string>("Modalidade")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("PlanoContrato")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("Skeelo")
.HasColumnType("numeric");
b.Property<string>("Skil")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("Solicitante")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Status")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.Property<decimal?>("ValorPlanoVivo")
.HasColumnType("numeric");
b.Property<string>("VencConta")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<decimal?>("VivoGestaoDispositivo")
.HasColumnType("numeric");
b.Property<decimal?>("VivoNewsPlus")
.HasColumnType("numeric");
b.Property<decimal?>("VivoTravelMundo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Linha")
.IsUnique();
b.ToTable("MobileLines");
});
modelBuilder.Entity("line_gestao_api.Models.MuregLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataDaMureg")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("ICCID");
b.HasIndex("Item");
b.HasIndex("LinhaNova");
b.ToTable("MuregLines");
});
modelBuilder.Entity("line_gestao_api.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("line_gestao_api.Models.UserData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Celular")
.HasColumnType("text");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Cpf")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataNascimento")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<string>("Endereco")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("Rg")
.HasColumnType("text");
b.Property<string>("TelefoneFixo")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("UserDatas");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace line_gestao_api.Migrations
{
/// <inheritdoc />
public partial class AddVigenciaLines : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -0,0 +1,384 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using line_gestao_api.Data;
#nullable disable
namespace line_gestao_api.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260107153627_FixVigenciaLinesPendingChanges")]
partial class FixVigenciaLinesPendingChanges
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("line_gestao_api.Models.BillingClient", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Aparelho")
.HasColumnType("text");
b.Property<string>("Cliente")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FormaPagamento")
.HasColumnType("text");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<int?>("QtdLinhas")
.HasColumnType("integer");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("character varying(2)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("Item");
b.HasIndex("Tipo");
b.HasIndex("Tipo", "Cliente");
b.ToTable("billing_clients", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.MobileLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cedente")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Chip")
.HasMaxLength(40)
.HasColumnType("character varying(40)");
b.Property<string>("Cliente")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Conta")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataBloqueio")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaCliente")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaOpera")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("Desconto")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaGestao")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<decimal?>("GestaoVozDados")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal?>("LocacaoAp")
.HasColumnType("numeric");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<string>("Modalidade")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("PlanoContrato")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("Skeelo")
.HasColumnType("numeric");
b.Property<string>("Skil")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("Solicitante")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Status")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.Property<decimal?>("ValorPlanoVivo")
.HasColumnType("numeric");
b.Property<string>("VencConta")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<decimal?>("VivoGestaoDispositivo")
.HasColumnType("numeric");
b.Property<decimal?>("VivoNewsPlus")
.HasColumnType("numeric");
b.Property<decimal?>("VivoTravelMundo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Linha")
.IsUnique();
b.ToTable("MobileLines");
});
modelBuilder.Entity("line_gestao_api.Models.MuregLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataDaMureg")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("ICCID");
b.HasIndex("Item");
b.HasIndex("LinhaNova");
b.ToTable("MuregLines");
});
modelBuilder.Entity("line_gestao_api.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("line_gestao_api.Models.UserData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Celular")
.HasColumnType("text");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Cpf")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataNascimento")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<string>("Endereco")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("Rg")
.HasColumnType("text");
b.Property<string>("TelefoneFixo")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("UserDatas");
});
modelBuilder.Entity("line_gestao_api.Models.VigenciaLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Conta")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtEfetivacaoServico")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtTerminoFidelizacao")
.HasColumnType("timestamp with time zone");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("PlanoContrato")
.HasColumnType("text");
b.Property<decimal?>("Total")
.HasColumnType("numeric");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("VigenciaLines");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,44 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace line_gestao_api.Migrations
{
/// <inheritdoc />
public partial class FixVigenciaLinesPendingChanges : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "VigenciaLines",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Item = table.Column<int>(type: "integer", nullable: false),
Conta = table.Column<string>(type: "text", nullable: true),
Linha = table.Column<string>(type: "text", nullable: true),
Cliente = table.Column<string>(type: "text", nullable: true),
Usuario = table.Column<string>(type: "text", nullable: true),
PlanoContrato = table.Column<string>(type: "text", nullable: true),
DtEfetivacaoServico = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
DtTerminoFidelizacao = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
Total = table.Column<decimal>(type: "numeric", nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VigenciaLines", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "VigenciaLines");
}
}
}

View File

@ -0,0 +1,422 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using line_gestao_api.Data;
#nullable disable
namespace line_gestao_api.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260107194444_AddTrocaNumeroLines")]
partial class AddTrocaNumeroLines
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("line_gestao_api.Models.BillingClient", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Aparelho")
.HasColumnType("text");
b.Property<string>("Cliente")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FormaPagamento")
.HasColumnType("text");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<int?>("QtdLinhas")
.HasColumnType("integer");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("character varying(2)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("Item");
b.HasIndex("Tipo");
b.HasIndex("Tipo", "Cliente");
b.ToTable("billing_clients", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.MobileLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cedente")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Chip")
.HasMaxLength(40)
.HasColumnType("character varying(40)");
b.Property<string>("Cliente")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Conta")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataBloqueio")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaCliente")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaOpera")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("Desconto")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaGestao")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<decimal?>("GestaoVozDados")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal?>("LocacaoAp")
.HasColumnType("numeric");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<string>("Modalidade")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("PlanoContrato")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("Skeelo")
.HasColumnType("numeric");
b.Property<string>("Skil")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("Solicitante")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Status")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.Property<decimal?>("ValorPlanoVivo")
.HasColumnType("numeric");
b.Property<string>("VencConta")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<decimal?>("VivoGestaoDispositivo")
.HasColumnType("numeric");
b.Property<decimal?>("VivoNewsPlus")
.HasColumnType("numeric");
b.Property<decimal?>("VivoTravelMundo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Linha")
.IsUnique();
b.ToTable("MobileLines");
});
modelBuilder.Entity("line_gestao_api.Models.MuregLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataDaMureg")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("ICCID");
b.HasIndex("Item");
b.HasIndex("LinhaNova");
b.ToTable("MuregLines");
});
modelBuilder.Entity("line_gestao_api.Models.TrocaNumeroLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataTroca")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<string>("Motivo")
.HasColumnType("text");
b.Property<string>("Observacao")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("TrocaNumeroLines");
});
modelBuilder.Entity("line_gestao_api.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("line_gestao_api.Models.UserData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Celular")
.HasColumnType("text");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Cpf")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataNascimento")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<string>("Endereco")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("Rg")
.HasColumnType("text");
b.Property<string>("TelefoneFixo")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("UserDatas");
});
modelBuilder.Entity("line_gestao_api.Models.VigenciaLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Conta")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtEfetivacaoServico")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtTerminoFidelizacao")
.HasColumnType("timestamp with time zone");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("PlanoContrato")
.HasColumnType("text");
b.Property<decimal?>("Total")
.HasColumnType("numeric");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("VigenciaLines");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,42 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace line_gestao_api.Migrations
{
/// <inheritdoc />
public partial class AddTrocaNumeroLines : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TrocaNumeroLines",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Item = table.Column<int>(type: "integer", nullable: false),
LinhaAntiga = table.Column<string>(type: "text", nullable: true),
LinhaNova = table.Column<string>(type: "text", nullable: true),
ICCID = table.Column<string>(type: "text", nullable: true),
DataTroca = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
Motivo = table.Column<string>(type: "text", nullable: true),
Observacao = table.Column<string>(type: "text", nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TrocaNumeroLines", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TrocaNumeroLines");
}
}
}

View File

@ -0,0 +1,512 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using line_gestao_api.Data;
#nullable disable
namespace line_gestao_api.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260108192113_AddParcelamento")]
partial class AddParcelamento
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("line_gestao_api.Models.BillingClient", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Aparelho")
.HasColumnType("text");
b.Property<string>("Cliente")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FormaPagamento")
.HasColumnType("text");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<int?>("QtdLinhas")
.HasColumnType("integer");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("character varying(2)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("Item");
b.HasIndex("Tipo");
b.HasIndex("Tipo", "Cliente");
b.ToTable("billing_clients", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.MobileLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cedente")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Chip")
.HasMaxLength(40)
.HasColumnType("character varying(40)");
b.Property<string>("Cliente")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Conta")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataBloqueio")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaCliente")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaOpera")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("Desconto")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaGestao")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<decimal?>("GestaoVozDados")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal?>("LocacaoAp")
.HasColumnType("numeric");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<string>("Modalidade")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("PlanoContrato")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("Skeelo")
.HasColumnType("numeric");
b.Property<string>("Skil")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("Solicitante")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Status")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.Property<decimal?>("ValorPlanoVivo")
.HasColumnType("numeric");
b.Property<string>("VencConta")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<decimal?>("VivoGestaoDispositivo")
.HasColumnType("numeric");
b.Property<decimal?>("VivoNewsPlus")
.HasColumnType("numeric");
b.Property<decimal?>("VivoTravelMundo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Linha")
.IsUnique();
b.ToTable("MobileLines");
});
modelBuilder.Entity("line_gestao_api.Models.MuregLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataDaMureg")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("ICCID");
b.HasIndex("Item");
b.HasIndex("LinhaNova");
b.ToTable("MuregLines");
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AnoRef")
.HasColumnType("integer");
b.Property<string>("Cliente")
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("Desconto")
.HasColumnType("numeric");
b.Property<int?>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property<string>("QtParcelas")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property<decimal?>("ValorCheio")
.HasColumnType("numeric");
b.Property<decimal?>("ValorComDesconto")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("AnoRef");
b.HasIndex("Cliente");
b.HasIndex("Linha");
b.ToTable("parcelamento_lines", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoMonthValue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("Competencia")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("ParcelamentoLineId")
.HasColumnType("uuid");
b.Property<decimal>("Valor")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Competencia");
b.HasIndex("ParcelamentoLineId");
b.HasIndex("ParcelamentoLineId", "Competencia")
.IsUnique();
b.ToTable("parcelamento_month_values", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.TrocaNumeroLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataTroca")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<string>("Motivo")
.HasColumnType("text");
b.Property<string>("Observacao")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("TrocaNumeroLines");
});
modelBuilder.Entity("line_gestao_api.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("line_gestao_api.Models.UserData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Celular")
.HasColumnType("text");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Cpf")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataNascimento")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<string>("Endereco")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("Rg")
.HasColumnType("text");
b.Property<string>("TelefoneFixo")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("UserDatas");
});
modelBuilder.Entity("line_gestao_api.Models.VigenciaLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Conta")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtEfetivacaoServico")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtTerminoFidelizacao")
.HasColumnType("timestamp with time zone");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("PlanoContrato")
.HasColumnType("text");
b.Property<decimal?>("Total")
.HasColumnType("numeric");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("VigenciaLines");
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoMonthValue", b =>
{
b.HasOne("line_gestao_api.Models.ParcelamentoLine", "ParcelamentoLine")
.WithMany("Meses")
.HasForeignKey("ParcelamentoLineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParcelamentoLine");
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoLine", b =>
{
b.Navigation("Meses");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,96 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace line_gestao_api.Migrations
{
/// <inheritdoc />
public partial class AddParcelamento : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "parcelamento_lines",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
AnoRef = table.Column<int>(type: "integer", nullable: true),
Item = table.Column<int>(type: "integer", nullable: true),
Linha = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
Cliente = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
QtParcelas = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
ValorCheio = table.Column<decimal>(type: "numeric", nullable: true),
Desconto = table.Column<decimal>(type: "numeric", nullable: true),
ValorComDesconto = table.Column<decimal>(type: "numeric", nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_parcelamento_lines", x => x.Id);
});
migrationBuilder.CreateTable(
name: "parcelamento_month_values",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ParcelamentoLineId = table.Column<Guid>(type: "uuid", nullable: false),
Competencia = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Valor = table.Column<decimal>(type: "numeric", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_parcelamento_month_values", x => x.Id);
table.ForeignKey(
name: "FK_parcelamento_month_values_parcelamento_lines_ParcelamentoLi~",
column: x => x.ParcelamentoLineId,
principalTable: "parcelamento_lines",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_parcelamento_lines_AnoRef",
table: "parcelamento_lines",
column: "AnoRef");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_lines_Cliente",
table: "parcelamento_lines",
column: "Cliente");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_lines_Linha",
table: "parcelamento_lines",
column: "Linha");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_month_values_Competencia",
table: "parcelamento_month_values",
column: "Competencia");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_month_values_ParcelamentoLineId",
table: "parcelamento_month_values",
column: "ParcelamentoLineId");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_month_values_ParcelamentoLineId_Competencia",
table: "parcelamento_month_values",
columns: new[] { "ParcelamentoLineId", "Competencia" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "parcelamento_month_values");
migrationBuilder.DropTable(
name: "parcelamento_lines");
}
}
}

View File

@ -0,0 +1,512 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using line_gestao_api.Data;
#nullable disable
namespace line_gestao_api.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260108192132_UpdateDatabaseSchema")]
partial class UpdateDatabaseSchema
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("line_gestao_api.Models.BillingClient", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Aparelho")
.HasColumnType("text");
b.Property<string>("Cliente")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FormaPagamento")
.HasColumnType("text");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<int?>("QtdLinhas")
.HasColumnType("integer");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("character varying(2)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("Item");
b.HasIndex("Tipo");
b.HasIndex("Tipo", "Cliente");
b.ToTable("billing_clients", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.MobileLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cedente")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Chip")
.HasMaxLength(40)
.HasColumnType("character varying(40)");
b.Property<string>("Cliente")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Conta")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataBloqueio")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaCliente")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataEntregaOpera")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("Desconto")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaGestao")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaLine")
.HasColumnType("numeric");
b.Property<decimal?>("FranquiaVivo")
.HasColumnType("numeric");
b.Property<decimal?>("GestaoVozDados")
.HasColumnType("numeric");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal?>("LocacaoAp")
.HasColumnType("numeric");
b.Property<decimal?>("Lucro")
.HasColumnType("numeric");
b.Property<string>("Modalidade")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("PlanoContrato")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("Skeelo")
.HasColumnType("numeric");
b.Property<string>("Skil")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<string>("Solicitante")
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("Status")
.HasMaxLength(80)
.HasColumnType("character varying(80)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<decimal?>("ValorContratoLine")
.HasColumnType("numeric");
b.Property<decimal?>("ValorContratoVivo")
.HasColumnType("numeric");
b.Property<decimal?>("ValorPlanoVivo")
.HasColumnType("numeric");
b.Property<string>("VencConta")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<decimal?>("VivoGestaoDispositivo")
.HasColumnType("numeric");
b.Property<decimal?>("VivoNewsPlus")
.HasColumnType("numeric");
b.Property<decimal?>("VivoTravelMundo")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Linha")
.IsUnique();
b.ToTable("MobileLines");
});
modelBuilder.Entity("line_gestao_api.Models.MuregLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataDaMureg")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Cliente");
b.HasIndex("ICCID");
b.HasIndex("Item");
b.HasIndex("LinhaNova");
b.ToTable("MuregLines");
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AnoRef")
.HasColumnType("integer");
b.Property<string>("Cliente")
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("Desconto")
.HasColumnType("numeric");
b.Property<int?>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property<string>("QtParcelas")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property<decimal?>("ValorCheio")
.HasColumnType("numeric");
b.Property<decimal?>("ValorComDesconto")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("AnoRef");
b.HasIndex("Cliente");
b.HasIndex("Linha");
b.ToTable("parcelamento_lines", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoMonthValue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("Competencia")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("ParcelamentoLineId")
.HasColumnType("uuid");
b.Property<decimal>("Valor")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Competencia");
b.HasIndex("ParcelamentoLineId");
b.HasIndex("ParcelamentoLineId", "Competencia")
.IsUnique();
b.ToTable("parcelamento_month_values", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.TrocaNumeroLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataTroca")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<string>("Motivo")
.HasColumnType("text");
b.Property<string>("Observacao")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("TrocaNumeroLines");
});
modelBuilder.Entity("line_gestao_api.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("line_gestao_api.Models.UserData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Celular")
.HasColumnType("text");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Cpf")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataNascimento")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<string>("Endereco")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("Rg")
.HasColumnType("text");
b.Property<string>("TelefoneFixo")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("UserDatas");
});
modelBuilder.Entity("line_gestao_api.Models.VigenciaLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Conta")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtEfetivacaoServico")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtTerminoFidelizacao")
.HasColumnType("timestamp with time zone");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("PlanoContrato")
.HasColumnType("text");
b.Property<decimal?>("Total")
.HasColumnType("numeric");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("VigenciaLines");
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoMonthValue", b =>
{
b.HasOne("line_gestao_api.Models.ParcelamentoLine", "ParcelamentoLine")
.WithMany("Meses")
.HasForeignKey("ParcelamentoLineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParcelamentoLine");
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoLine", b =>
{
b.Navigation("Meses");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace line_gestao_api.Migrations
{
/// <inheritdoc />
public partial class UpdateDatabaseSchema : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -249,6 +249,118 @@ namespace line_gestao_api.Migrations
b.ToTable("MuregLines"); b.ToTable("MuregLines");
}); });
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AnoRef")
.HasColumnType("integer");
b.Property<string>("Cliente")
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("Desconto")
.HasColumnType("numeric");
b.Property<int?>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property<string>("QtParcelas")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property<decimal?>("ValorCheio")
.HasColumnType("numeric");
b.Property<decimal?>("ValorComDesconto")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("AnoRef");
b.HasIndex("Cliente");
b.HasIndex("Linha");
b.ToTable("parcelamento_lines", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoMonthValue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("Competencia")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("ParcelamentoLineId")
.HasColumnType("uuid");
b.Property<decimal>("Valor")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("Competencia");
b.HasIndex("ParcelamentoLineId");
b.HasIndex("ParcelamentoLineId", "Competencia")
.IsUnique();
b.ToTable("parcelamento_month_values", (string)null);
});
modelBuilder.Entity("line_gestao_api.Models.TrocaNumeroLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataTroca")
.HasColumnType("timestamp with time zone");
b.Property<string>("ICCID")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("LinhaAntiga")
.HasColumnType("text");
b.Property<string>("LinhaNova")
.HasColumnType("text");
b.Property<string>("Motivo")
.HasColumnType("text");
b.Property<string>("Observacao")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("TrocaNumeroLines");
});
modelBuilder.Entity("line_gestao_api.Models.User", b => modelBuilder.Entity("line_gestao_api.Models.User", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -284,6 +396,113 @@ namespace line_gestao_api.Migrations
b.ToTable("Users"); b.ToTable("Users");
}); });
modelBuilder.Entity("line_gestao_api.Models.UserData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Celular")
.HasColumnType("text");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Cpf")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DataNascimento")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<string>("Endereco")
.HasColumnType("text");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("Rg")
.HasColumnType("text");
b.Property<string>("TelefoneFixo")
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("UserDatas");
});
modelBuilder.Entity("line_gestao_api.Models.VigenciaLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Cliente")
.HasColumnType("text");
b.Property<string>("Conta")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtEfetivacaoServico")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DtTerminoFidelizacao")
.HasColumnType("timestamp with time zone");
b.Property<int>("Item")
.HasColumnType("integer");
b.Property<string>("Linha")
.HasColumnType("text");
b.Property<string>("PlanoContrato")
.HasColumnType("text");
b.Property<decimal?>("Total")
.HasColumnType("numeric");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Usuario")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("VigenciaLines");
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoMonthValue", b =>
{
b.HasOne("line_gestao_api.Models.ParcelamentoLine", "ParcelamentoLine")
.WithMany("Meses")
.HasForeignKey("ParcelamentoLineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParcelamentoLine");
});
modelBuilder.Entity("line_gestao_api.Models.ParcelamentoLine", b =>
{
b.Navigation("Meses");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

View File

@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
namespace line_gestao_api.Models
{
public class ParcelamentoLine
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
public int? AnoRef { get; set; } // coluna "2025" (primeira coluna numérica)
public int? Item { get; set; } // coluna do item (1,2,3...)
[MaxLength(32)]
public string? Linha { get; set; }
[MaxLength(120)]
public string? Cliente { get; set; }
[MaxLength(32)]
public string? QtParcelas { get; set; } // exemplo "06/24"
public decimal? ValorCheio { get; set; }
public decimal? Desconto { get; set; }
public decimal? ValorComDesconto { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public List<ParcelamentoMonthValue> Meses { get; set; } = new();
}
}

View File

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace line_gestao_api.Models
{
public class ParcelamentoMonthValue
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[ForeignKey(nameof(ParcelamentoLine))]
public Guid ParcelamentoLineId { get; set; }
public ParcelamentoLine? ParcelamentoLine { get; set; }
// Competência (sempre dia 01)
public DateTime Competencia { get; set; }
public decimal Valor { get; set; }
}
}

23
Models/TrocaNumeroLine.cs Normal file
View File

@ -0,0 +1,23 @@
using System;
namespace line_gestao_api.Models
{
public class TrocaNumeroLine
{
public Guid Id { get; set; }
public int Item { get; set; }
public string? LinhaAntiga { get; set; }
public string? LinhaNova { get; set; }
public string? ICCID { get; set; }
public DateTime? DataTroca { get; set; }
public string? Motivo { get; set; }
public string? Observacao { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
}

30
Models/UserData.cs Normal file
View File

@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace line_gestao_api.Models
{
public class UserData
{
[Key]
public Guid Id { get; set; }
public int Item { get; set; }
public string? Linha { get; set; }
public string? Cliente { get; set; }
public string? Cpf { get; set; }
public string? Rg { get; set; }
public DateTime? DataNascimento { get; set; }
public string? Email { get; set; }
public string? Endereco { get; set; }
public string? Celular { get; set; }
public string? TelefoneFixo { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
}

27
Models/VigenciaLine.cs Normal file
View File

@ -0,0 +1,27 @@
using System;
namespace line_gestao_api.Models
{
public class VigenciaLine
{
public Guid Id { get; set; }
public int Item { get; set; }
public string? Conta { get; set; }
public string? Linha { get; set; }
public string? Cliente { get; set; }
public string? Usuario { get; set; }
public string? PlanoContrato { get; set; }
public DateTime? DtEfetivacaoServico { get; set; }
public DateTime? DtTerminoFidelizacao { get; set; }
public decimal? Total { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
}