feat: logs e cores dos planos

This commit is contained in:
Ricardo Carneiro 2024-10-16 23:43:47 -03:00
parent 950400e0a8
commit 7b425e4df7
20 changed files with 227 additions and 28 deletions

View File

@ -6,6 +6,14 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="4.0.2" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Enrichers.Context" Version="4.6.5" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Grafana.Loki" Version="8.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\vcart.me\vcart.back\Struct.ValueObjects\BaseDomain.csproj" />
</ItemGroup>

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Blinks.Domain.Entities
{
public class LinkBio
{
/// <summary>
/// Ordem de exibição
/// </summary>
public int OrderNum { get; set; }
/// <summary>
/// Parte customizada do link
/// </summary>
public string UrlData { get; set; }
/// <summary>
/// Parte fixa do link (obter do service links quando cadastrar)
/// </summary>
public string ServiceUrl { get; set; }
/// <summary>
/// Url/caminho do PNG do link
/// </summary>
public string ServiceIcon { get; set; }
/// <summary>
/// Exibir/nao exibir
/// </summary>
public bool IsVisible { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Blinks.Domain.Entities
{
public class PageBio
{
public int Id { get; set; }
public string UrlParte1 { get; set; }
public string UrlParte2 { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public List<LinkBio>? Links { get; set; }
}
}

View File

@ -16,8 +16,12 @@ namespace Blinks.Domain.Entities
public string LastName => Name.LastName;
public Email Email { get; private set; }
public DateChanged DateChanged { get; private set; }
public bool IsCompleted { get; private set; }
public bool IsProfileCompleted { get; private set; }
public int CountryId { get; private set; }
public int BusinessAreaId { get; private set; }
public string DesiredName { get; private set; }
public DateTime CreatedAt { get; private set; }
public UserPlan? Plano { get; private set; }
public List<UserPlan>? PastPlans { get; private set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Blinks.Domain.Entities
{
public class ServiceLinkPart
{
public int OrderNum { get; set; }
public string Name { get; set; }
public string VariableName { get; set; }
public string Value { get; set; }
public bool CanUserEdit { get; set; }
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Blinks.Domain.Entities
{
/// <summary>
/// Vai ler uma lista estatica do BD com os links dos serviços
/// </summary>
public class ServiceLink
{
/// <summary>
/// Id do serviço
/// </summary>
public string Id { get; set; }
/// <summary>
/// Nome do serviço
/// </summary>
public string Name { get; set; }
/// <summary>
/// Guarda a primeira parta da url do serviço
/// </summary>
public string FirstPart { get; set; }
/// <summary>
/// Guarda outras partes/parametros da url (indicando partes customizaveis)
/// </summary>
public List<ServiceLinkPart> Parts { get; set; }
}
}

View File

@ -9,11 +9,12 @@ namespace Blinks.Domain.Entities
public class UserPlan
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string UserPlanId { get; set; }
public string IdPagto { get; private set; }
public string EmailPagto { get; private set; }
public DateTime? DatePagto { get; private set; }
public DateTime? DateUntil { get; private set; }
}
}

View File

@ -9,6 +9,11 @@
<ItemGroup>
<PackageReference Include="MongoDB.Bson" Version="2.28.0" />
<PackageReference Include="MongoDB.Driver" Version="2.28.0" />
<PackageReference Include="Serilog" Version="4.0.2" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Enrichers.Context" Version="4.6.5" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Grafana.Loki" Version="8.3.0" />
</ItemGroup>
</Project>

View File

@ -12,6 +12,11 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="8.0.7" />
<PackageReference Include="Serilog" Version="4.0.2" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Enrichers.Context" Version="4.6.5" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Grafana.Loki" Version="8.3.0" />
<PackageReference Include="Stripe.net" Version="45.13.0" />
</ItemGroup>

View File

@ -6,15 +6,16 @@ namespace Blinks.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly ILogger<HomeController> logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
this.logger = logger;
}
public IActionResult Index()
{
this.logger.LogInformation("Home carregada!");
return View();
}

View File

@ -18,11 +18,11 @@ namespace Blinks.Controllers
{
this.logger = logger;
this.httpClientFactory = httpClientFactory;
}
}
public IActionResult Index()
public IActionResult Index()
{
return View("~/Views/Login/Index.cshtml");
return View("~/Views/Login/Index.cshtml");
}
[HttpPost]

View File

@ -0,0 +1,12 @@
//using Serilog.Sinks.Loki;
//namespace Blinks.LogConfig
//{
// public class LogCredentials : LokiCredentials
// {
// public LogCredentials(string url)
// {
// this.Url = url;
// }
// }
//}

View File

@ -0,0 +1,27 @@
//using Serilog.Sinks.Loki.Labels;
namespace Blinks.LogConfig
{
//public class LogLabelProvider : ILogLabelProvider
//{
// public IList<LokiLabel> GetLabels()
// {
// return new List<LokiLabel>
// {
// new LokiLabel("app", "blinks"),
// new LokiLabel("namespace", "test")
// };
// }
// public IList<string> PropertiesAsLabels { get; set; } = new List<string>
// {
// "level", // Since 3.0.0, you need to explicitly add level if you want it!
// "MyLabelPropertyName"
// };
// public IList<string> PropertiesToAppend { get; set; } = new List<string>
// {
// "MyAppendPropertyName"
// };
// //public LokiFormatterStrategy FormatterStrategy { get; set; } = LokiFormatterStrategy.SpecificPropertiesAsLabelsOrAppended;
//}
}

View File

@ -1,15 +1,37 @@
using Blinks.LogConfig;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.Google;
using Microsoft.AspNetCore.Authentication.MicrosoftAccount;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.Extensions.Options;
using Serilog;
using Serilog.Sinks.Grafana.Loki;
using Stripe;
using Stripe.Forwarding;
using System.Globalization;
using System.Security.Policy;
var builder = WebApplication.CreateBuilder(args);
//var credentials = new BasicAuthCredentials("http://192.168.0.82:3100");
//var credentials = new LogCredentials("http://192.168.0.82:3100");
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.Enrich.FromLogContext()
.Enrich.WithProperty("app", "blinks")
.WriteTo.Console()
.WriteTo.File("logs/log.txt", rollingInterval: RollingInterval.Day)
.WriteTo.GrafanaLoki(
uri: "http://192.168.0.82:3100",
propertiesAsLabels: new List<string> { "app", "blinks" },
restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Debug
)
.CreateLogger();
builder.Host.UseSerilog();
// Add services to the container.
builder.Services.AddControllersWithViews();
@ -64,6 +86,7 @@ builder.Services.Configure<RequestLocalizationOptions>(options =>
StripeConfiguration.ApiKey = builder.Configuration["Stripe:SecretKey"];
builder.Services.AddControllersWithViews();
builder.Services.AddHttpClient();
builder.Services.AddSerilog();
var app = builder.Build();
@ -93,6 +116,8 @@ app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.UseSerilogRequestLogging();
app.UseRequestLocalization();
app.Run();

View File

@ -217,10 +217,10 @@
<value>Email</value>
</data>
<data name="GroupNameLabel" xml:space="preserve">
<value>Empresa / Grupo</value>
<value>Nome desejado para sua bio/página</value>
</data>
<data name="GroupPlaceHolder" xml:space="preserve">
<value>Nome desejado para o grupo</value>
<value>Nome desejado na sua bio/página</value>
</data>
<data name="InitialFormTitle" xml:space="preserve">
<value>Dados iniciais</value>

View File

@ -21,7 +21,14 @@
<li><i class="bi bi-square text-success"></i><span class="hide-in-cell">Sem contador de </span>Visualizações</span></li>
</ul>
<div class="pricing-footer">
<div class="btn db-button-color-square btn-lg">Plano Atual</div>
@if (User.Identity.IsAuthenticated)
{
<div class="btn db-button-color-square btn-lg">Plano Inicial</div>
}
else
{
<div class="btn db-button-color-square btn-lg">Comece com este!</div>
}
</div>
</div>
</div>

View File

@ -11,7 +11,7 @@ License: MIT
BACKGROUND COLORS
============================================================*/
.db-bk-color-one {
background-color: #A9B595;
background-color: #D9EDD2;
}
.db-bk-color-two {
@ -19,7 +19,7 @@ BACKGROUND COLORS
}
.db-bk-color-three {
background-color: #97A47E;
background-color: #D9EDD2;
}
.db-bk-color-six {
@ -74,10 +74,10 @@ BACKGROUND COLORS
}
.db-pricing-eleven .price {
background-color: rgba(0, 0, 0, 0);
color: #FFFFFF;
}
.db-pricing-eleven .price {
background-color: rgba(0, 0, 0, 0);
color: #353000;
}
.db-pricing-eleven .price small {
color: #63783F;

View File

@ -122,10 +122,9 @@
});
$(document).ready(function () {
//$('#wrapper').fadeIn('slow');
$('#wrapper').fadeIn('slow');
$('a.nav-link').click(function () {
//$('#wrapper').fadeOut('slow');
$('#wrapper').fadeOut('slow');
});
setActiveByLocation();
});

View File

@ -165,17 +165,17 @@ button.accept-policy {
padding-right: 3px;
}
.navbar .navbar-collapse ul.navbar-nav .nav-item.active {
color: white;
padding-left: 3px;
padding-right: 3px;
background-color: #C7CCB8 !important;
border-radius: 7px 7px 7px 7px;
.navbar .navbar-collapse ul.navbar-nav .nav-item.active {
color: white;
padding-left: 3px;
padding-right: 3px;
background-color: #809062 !important;
border-radius: 7px 7px 7px 7px;
/*
background-color: #b8f2a1 !important;
*/
}
}
a.nav-link.text-black {
color: black !important;