Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Fin-Backend.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABadHttpRequestException_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F58fd8e539d784853aa0a483642931ebf4c000_003F16_003Fbb4f7d05_003FBadHttpRequestException_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACallerIdentifier_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F71f2ec7617c4a98abe150a490d848fca9f9da94acbda7b12e237ec81dcd3_003FCallerIdentifier_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACancellationToken_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3c32b6774a69464667352a9e262bc924c57674f811c382e29abe8dbe3639f4c_003FCancellationToken_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADayOfWeek_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F2beab19a5e094b7480e8f255095b9e76e26800_003F77_003Fbe7e7f31_003FDayOfWeek_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADecimal_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fb926483dd9373e252824fb9f8bdf906c40ada3256d27f68392f486b2c1f6c_003FDecimal_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFieldInfo_002ECoreCLR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fa4f51f201dca40bd938f37a528b1d91b4f1089a8ba612a057c4732bf7c21aad_003FFieldInfo_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIMongoCollection_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3c17fe633e8c430094c5074d1511b9d6268000_003Fbc_003F3863f8c1_003FIMongoCollection_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F1c3f7d5c03bf77051eb8a758fb3549c4e2d4cb3dc6f6d567a94a315044961e_003FList_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1cb0ee423e6b413691aee222686aa63eb400_003F09_003F397dd16b_003FList_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModelBuilder_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fd83f823935e343bfaf4ef4c6263b8a12291438_003F33_003Fc1982b24_003FModelBuilder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
Expand All @@ -20,6 +22,7 @@
&lt;Project Location="/home/rafaelchicovis/git/fin-backend/Fin.Test" Presentation="&amp;lt;Fin.Test&amp;gt;" /&gt;
&lt;/SessionState&gt;</s:String>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Fin_002EApplication_002FResources_002FEmailTemplates_002FEmailTemplates/@EntryIndexedValue">True</s:Boolean>

<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Fin_002EApplication_002FResources_002FEmailTemplates_002FResources_002Ees_002DEN/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Fin_002EApplication_002FResources_002FEmailTemplates_002FResources_002Ees_002DEN/@EntryIndexRemoved">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Fin_002EApplication_002FResources_002FEmailTemplates_002FResources/@EntryIndexedValue">False</s:Boolean>
Expand Down
3 changes: 2 additions & 1 deletion Fin.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
}
},
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=fin_app;Username=fin_app;Password=fin_app"
"DefaultConnection": "Host=localhost;Port=5432;Database=fin_app;Username=fin_app;Password=fin_app",
"MongoDbConnection": "mongodb://localhost:27017"
},
"AllowedHosts": "*",
"ApiSettings": {
Expand Down
17 changes: 16 additions & 1 deletion Fin.Domain/CardBrands/Entities/CardBrand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Fin.Domain.CardBrands.Entities;

public class CardBrand: IAuditedEntity
public class CardBrand: IAuditedEntity, ILoggable
{
public string Name { get; set; }
public string Icon { get; set; }
Expand Down Expand Up @@ -36,4 +36,19 @@ public void Update(CardBrandInput input)
Color = input.Color;

}

public object GetLog()
{
return new
{
Id,
CreatedAt,
CreatedBy,
UpdatedAt,
UpdatedBy,
Name,
Color,
Icon
};
}
}
23 changes: 22 additions & 1 deletion Fin.Domain/CreditCards/Entities/CreditCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Fin.Domain.CreditCards.Entities;

public class CreditCard: IAuditedTenantEntity
public class CreditCard: ILoggableAuditedTenantEntity
{
public string Name { get; private set; }
public string Color { get; private set; }
Expand Down Expand Up @@ -63,4 +63,25 @@ public void Update(CreditCardInput input)
}

public void ToggleInactivated() => Inactivated = !Inactivated;

public object GetLog()
{
return new
{
Id,
CreatedAt,
CreatedBy,
UpdatedAt,
UpdatedBy,
TenantId,
Name,
Color,
Icon,
Limit,
DueDay,
ClosingDay,
DebitWalletId,
FinancialInstitutionId,
};
}
}
4 changes: 0 additions & 4 deletions Fin.Domain/Fin.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,4 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<Folder Include="CardBrands\Enums\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using Fin.Domain.CreditCards.Entities;
using Fin.Domain.FinancialInstitutions.Dtos;
using Fin.Domain.FinancialInstitutions.Enums;
using Fin.Domain.Global.Decorators;
using Fin.Domain.Global.Interfaces;
using Fin.Domain.Wallets.Entities;

namespace Fin.Domain.FinancialInstitutions.Entities;

public class FinancialInstitution : IAuditedEntity
public class FinancialInstitution : IAuditedEntity, ILoggable
{
public string Name { get; set; }
public string Code { get; set; }
Expand Down Expand Up @@ -47,4 +48,21 @@ public void Update(FinancialInstitutionInput input)
}

public void ToggleInactive() => Inactive = !Inactive;
public object GetLog()
{
return new
{
Id,
CreatedAt,
CreatedBy,
UpdatedAt,
UpdatedBy,
Code,
Icon,
Color,
Inactive,
Type,
TypeDescription = Type.GetTranslateKey(),
};
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
using Fin.Domain.Global.Decorators;

namespace Fin.Domain.FinancialInstitutions.Enums
{
public enum FinancialInstitutionType
{
[FrontTranslateKey("finCore.features.financialInstitutions.type.bank")]
Bank = 0,
[FrontTranslateKey("finCore.features.financialInstitutions.type.digitalBank")]
DigitalBank = 1,
[FrontTranslateKey("finCore.features.financialInstitutions.type.foodCard")]
FoodCard = 2,
}
}
32 changes: 32 additions & 0 deletions Fin.Domain/Global/Decorators/FrontTranslateKeyAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Reflection;

namespace Fin.Domain.Global.Decorators;

[AttributeUsage(AttributeTargets.Field)]
public class FrontTranslateKeyAttribute(string translateKey): Attribute
{
public string TranslateKey { get; } = translateKey;
}


public static class FrontTranslateKeyExtension
{
public static string GetTranslateKey<T>(this T valeu, bool throwIfNotFoundMessage = true)
{
var type = valeu.GetType();
var memberInfo = type.GetMember(valeu.ToString() ?? string.Empty);

if (memberInfo.Length > 0)
{
var attribute = memberInfo[0].GetCustomAttribute<FrontTranslateKeyAttribute>();
if (attribute != null)
{
return attribute.TranslateKey;
}
}

return throwIfNotFoundMessage
? throw new ArgumentException($"Cannot get translate key {valeu}")
: string.Empty;
}
}
6 changes: 6 additions & 0 deletions Fin.Domain/Global/Interfaces/ILoggable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Fin.Domain.Global.Interfaces;

public interface ILoggable
{
object GetLog();
}
6 changes: 6 additions & 0 deletions Fin.Domain/Global/Interfaces/ILoggableAuditedTenantEntity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Fin.Domain.Global.Interfaces;

public interface ILoggableAuditedTenantEntity: ILoggable, IAuditedEntity, ITenantEntity
{

}
25 changes: 23 additions & 2 deletions Fin.Domain/Menus/Entities/Menu.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Fin.Domain.Global.Interfaces;
using Fin.Domain.Global.Decorators;
using Fin.Domain.Global.Interfaces;
using Fin.Domain.Menus.Dtos;
using Fin.Domain.Menus.Enums;

namespace Fin.Domain.Menus.Entities;

public class Menu: IAuditedEntity
public class Menu: IAuditedEntity, ILoggable
{
public string FrontRoute { get; set; }
public string Name { get; set; }
Expand Down Expand Up @@ -45,4 +46,24 @@ public void Update(MenuInput input)
OnlyForAdmin = input.OnlyForAdmin;
Position = input.Position;
}

public object GetLog()
{
return new
{
Id,
CreatedAt,
CreatedBy,
UpdatedAt,
UpdatedBy,
FrontRoute,
Name,
Icon,
Color,
KeyWords,
OnlyForAdmin,
Position,
PositionDescription = Position.GetTranslateKey()
};
}
}
7 changes: 6 additions & 1 deletion Fin.Domain/Menus/Enums/MenuPosition.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
namespace Fin.Domain.Menus.Enums;
using Fin.Domain.Global.Decorators;

namespace Fin.Domain.Menus.Enums;

public enum MenuPosition
{
[FrontTranslateKey("finCore.features.menus.hide")]
Hide = 0,
[FrontTranslateKey("finCore.features.menus.leftTop")]
LeftTop = 1,
[FrontTranslateKey("finCore.features.menus.leftBottom")]
LeftBottom = 2
}
28 changes: 27 additions & 1 deletion Fin.Domain/Notifications/Entities/Notification.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Collections.ObjectModel;
using Fin.Domain.Global.Decorators;
using Fin.Domain.Global.Extensions;
using Fin.Domain.Global.Interfaces;
using Fin.Domain.Notifications.Dtos;
using Fin.Domain.Notifications.Enums;

namespace Fin.Domain.Notifications.Entities;

public class Notification: IAuditedEntity
public class Notification: IAuditedEntity, ILoggable
{
public List<NotificationWay> Ways { get; set; } = [];
public string TextBody { get; set; }
Expand Down Expand Up @@ -90,4 +91,29 @@ public List<NotificationUserDelivery> UpdateAndReturnToRemoveDeliveries(Notifica

return deliveriesToDelete;
}

public object GetLog()
{
return new
{
Id,
CreatedAt,
CreatedBy,
UpdatedAt,
UpdatedBy,
Ways,
WaysDescriptions = Ways.Select(way => way.GetTranslateKey()),
TextBody,
HtmlBody,
NormalizedTextBody,
Title,
Continuous,
NormalizedTitle,
StartToDelivery,
StopToDelivery,
Link,
Severity,
SeverityDescriptions = Severity.GetTranslateKey(),
};
}
}
17 changes: 15 additions & 2 deletions Fin.Domain/Notifications/Entities/NotificationUserDelivery.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Fin.Domain.Users.Entities;
using Fin.Domain.Global.Interfaces;
using Fin.Domain.Users.Entities;

namespace Fin.Domain.Notifications.Entities;

public class NotificationUserDelivery
public class NotificationUserDelivery: ILoggable
{
public Guid NotificationId { get; set; }
public Guid UserId { get; set; }
Expand Down Expand Up @@ -33,4 +34,16 @@ public void MarkAsVisualized()
{
Visualized = true;
}

public object GetLog()
{
return new
{
NotificationId,
UserId,
Delivery,
Visualized,
BackgroundJobId
};
}
}
23 changes: 21 additions & 2 deletions Fin.Domain/Notifications/Entities/UserNotificationSettings.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using Fin.Domain.Global.Interfaces;
using Fin.Domain.Global.Decorators;
using Fin.Domain.Global.Interfaces;
using Fin.Domain.Notifications.Dtos;
using Fin.Domain.Notifications.Enums;
using Fin.Domain.Users.Entities;

namespace Fin.Domain.Notifications.Entities;

public class UserNotificationSettings: IAuditedTenantEntity
public class UserNotificationSettings: ILoggableAuditedTenantEntity
{
public Guid UserId { get; set; }
public bool Enabled { get; set; }
Expand Down Expand Up @@ -61,4 +62,22 @@ public void RemoveTokens(List<string> tokens)
{
FirebaseTokens = FirebaseTokens.Except(tokens).ToList();
}

public object GetLog()
{
return new
{
Id,
CreatedAt,
CreatedBy,
UpdatedAt,
UpdatedBy,
TenantId,
UserId,
Enabled,
AllowedWays,
AllowedWaysDesciptions = AllowedWays.Select(way => way.GetTranslateKey()),
FirebaseTokens
};
}
}
Loading
Loading