Skip to content

Commit

Permalink
profile / filter fields review
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhiogo Acioli committed Nov 3, 2024
1 parent 70b5ab2 commit 37763ee
Show file tree
Hide file tree
Showing 211 changed files with 12,762 additions and 16,161 deletions.
2 changes: 1 addition & 1 deletion MM.API/Functions/LoginFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class LoginFunction(CosmosRepository repo)
//[OpenApiOperation("LoginAdd", "Azure (Cosmos DB)")]
//[OpenApiResponseWithBody(HttpStatusCode.OK, "application/json", typeof(void))]
[Function("LoginAdd")]
public async Task Add(
public async Task LoginAdd(
[HttpTrigger(AuthorizationLevel.Anonymous, Method.POST, Route = "login/add")] HttpRequestData req, CancellationToken cancellationToken)
{
try
Expand Down
10 changes: 5 additions & 5 deletions MM.API/Functions/PrincipalFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class PrincipalFunction(CosmosRepository repo)
//[OpenApiOperation("PrincipalGet", "Azure (Cosmos DB)")]
//[OpenApiResponseWithBody(HttpStatusCode.OK, "application/json", typeof(ClientePrincipal))]
[Function("PrincipalGet")]
public async Task<ClientePrincipal?> Get(
public async Task<ClientePrincipal?> PrincipalGet(
[HttpTrigger(AuthorizationLevel.Anonymous, Method.GET, Route = "Principal/Get")] HttpRequestData req, CancellationToken cancellationToken)
{
try
Expand All @@ -26,7 +26,7 @@ public class PrincipalFunction(CosmosRepository repo)
}

[Function("PrincipalGetEmail")]
public async Task<string?> GetEmail(
public async Task<string?> PrincipalGetEmail(
[HttpTrigger(AuthorizationLevel.Anonymous, Method.GET, Route = "Public/Principal/GetEmail")] HttpRequestData req, CancellationToken cancellationToken)
{
try
Expand All @@ -46,7 +46,7 @@ public class PrincipalFunction(CosmosRepository repo)
//[OpenApiOperation("PrincipalAdd", "Azure (Cosmos DB)")]
//[OpenApiResponseWithBody(HttpStatusCode.OK, "application/json", typeof(ClientePrincipal))]
[Function("PrincipalAdd")]
public async Task<ClientePrincipal?> Add(
public async Task<ClientePrincipal?> PrincipalAdd(
[HttpTrigger(AuthorizationLevel.Anonymous, Method.POST, Route = "Principal/Add")] HttpRequestData req, CancellationToken cancellationToken)
{
try
Expand All @@ -63,7 +63,7 @@ public class PrincipalFunction(CosmosRepository repo)
}

[Function("PrincipalPaddle")]
public async Task<ClientePrincipal> Paddle(
public async Task<ClientePrincipal> PrincipalPaddle(
[HttpTrigger(AuthorizationLevel.Anonymous, Method.PUT, Route = "Principal/Paddle")] HttpRequestData req, CancellationToken cancellationToken)
{
try
Expand All @@ -85,7 +85,7 @@ public async Task<ClientePrincipal> Paddle(
}

[Function("PrincipalRemove")]
public async Task Remove(
public async Task PrincipalRemove(
[HttpTrigger(AuthorizationLevel.Anonymous, Method.DELETE, Route = "Principal/Remove")] HttpRequestData req, CancellationToken cancellationToken)
{
try
Expand Down
5 changes: 2 additions & 3 deletions MM.API/Functions/ProfileFunction.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Microsoft.Azure.Cosmos;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using MM.Shared.Models.Profile;
Expand All @@ -10,7 +9,7 @@ public class ProfileFunction(CosmosProfileRepository repo)
private readonly CosmosProfileRepository _repo = repo;

[Function("ProfileGet")]
public async Task<ProfileModel?> Get(
public async Task<ProfileModel?> ProfileGet(
[HttpTrigger(AuthorizationLevel.Function, Method.GET, Route = "profile/get")] HttpRequestData req, CancellationToken cancellationToken)
{
try
Expand Down Expand Up @@ -73,7 +72,7 @@ public class ProfileFunction(CosmosProfileRepository repo)
//}

[Function("ProfileUpdate")]
public async Task<ProfileModel> Update(
public async Task<ProfileModel> ProfileUpdate(
[HttpTrigger(AuthorizationLevel.Function, Method.PUT, Route = "profile/update")] HttpRequestData req, CancellationToken cancellationToken)
{
try
Expand Down
4 changes: 2 additions & 2 deletions MM.API/MM.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<Compile Remove="Functions\StorageFunction.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.67" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.70" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.44.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.45.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
Expand Down
8 changes: 4 additions & 4 deletions MM.Shared/Core/Helper/CustomAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace MM.Shared.Core.Helper
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class CustomAttribute : Attribute
{
public string? Group { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public string? Group { get; set; }
public string? Prompt { get; set; }
public string? Placeholder { get; set; }
public string? FieldInfo { get; set; }

/// <summary>
Expand Down Expand Up @@ -69,10 +69,10 @@ public static CustomAttribute GetCustomAttribute(this MemberInfo mi, bool transl
{
var rm = new ResourceManager(attr.ResourceType.FullName ?? "", attr.ResourceType.Assembly);

if (!string.IsNullOrEmpty(attr.Group)) attr.Group = rm.GetString(attr.Group) ?? attr.Group + " (incomplete translation)";
if (!string.IsNullOrEmpty(attr.Name)) attr.Name = rm.GetString(attr.Name) ?? attr.Name + " (incomplete translation)";
if (!string.IsNullOrEmpty(attr.Description)) attr.Description = rm.GetString(attr.Description) ?? attr.Description + " (incomplete translation)";
if (!string.IsNullOrEmpty(attr.Group)) attr.Group = rm.GetString(attr.Group) ?? attr.Group + " (incomplete translation)";
if (!string.IsNullOrEmpty(attr.Prompt)) attr.Prompt = rm.GetString(attr.Prompt)?.Replace(@"\n", Environment.NewLine);
if (!string.IsNullOrEmpty(attr.Placeholder)) attr.Placeholder = rm.GetString(attr.Placeholder)?.Replace(@"\n", Environment.NewLine);
if (!string.IsNullOrEmpty(attr.FieldInfo)) attr.FieldInfo = rm.GetString(attr.FieldInfo)?.Replace(@"\n", Environment.NewLine) ?? attr.FieldInfo.Replace(@"\n", Environment.NewLine) + " (incomplete translation)";
if (!string.IsNullOrEmpty(attr.Tips)) attr.Tips = rm.GetString(attr.Tips) ?? attr.Tips + " (incomplete translation)";
}
Expand Down
8 changes: 4 additions & 4 deletions MM.Shared/Core/Helper/EnumHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ public static IEnumerable<EnumObject> GetList<TEnum>(bool translate = true) wher
{
var attr = val.GetCustomAttribute(translate);

yield return new EnumObject(val, attr?.Name, attr?.Description, attr?.Group, attr?.Prompt, attr?.FieldInfo, attr?.Tips);
yield return new EnumObject(val, attr?.Name, attr?.Description, attr?.Group, attr?.Placeholder, attr?.FieldInfo, attr?.Tips);
}
}
}

public class EnumObject(Enum value, string? name, string? description, string? group, string? prompt, string? fieldInfo, string? tips)
public class EnumObject(Enum value, string? name, string? description, string? group, string? placeholder, string? fieldInfo, string? tips)
{
public Enum Value { get; set; } = value;
public string? Group { get; set; } = group;
public string? Name { get; set; } = name;
public string? Description { get; set; } = description;
public string? Group { get; set; } = group;
public string? Prompt { get; set; } = prompt;
public string? Placeholder { get; set; } = placeholder;
public string? FieldInfo { get; set; } = fieldInfo;
public string? Tips { get; set; } = tips;
}
Expand Down
61 changes: 41 additions & 20 deletions MM.Shared/Enums/AnnualIncome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,55 @@
{
public enum AnnualIncome
{
[Custom(Name = "_0K_1K", ResourceType = typeof(Resources.AnnualIncome))]
_0K_1K = 1,
[Custom(Name = "_0_500", ResourceType = typeof(Resources.AnnualIncome))]
_0_500 = 1,

[Custom(Name = "_2K_5K", ResourceType = typeof(Resources.AnnualIncome))]
_2K_5K = 2,
[Custom(Name = "_500_750", ResourceType = typeof(Resources.AnnualIncome))]
_500_750 = 2,

[Custom(Name = "_6K_10K", ResourceType = typeof(Resources.AnnualIncome))]
_6K_10K = 3,
[Custom(Name = "_750_1K", ResourceType = typeof(Resources.AnnualIncome))]
_750_1K = 3,

[Custom(Name = "_20K_50K", ResourceType = typeof(Resources.AnnualIncome))]
_20K_50K = 4,
[Custom(Name = "_1K_1_6K", ResourceType = typeof(Resources.AnnualIncome))]
_1K_1_6K = 4,

[Custom(Name = "_60K_100K", ResourceType = typeof(Resources.AnnualIncome))]
_60K_100K = 5,
[Custom(Name = "_1_6K_2_5K", ResourceType = typeof(Resources.AnnualIncome))]
_1_6K_2_5K = 5,

[Custom(Name = "_200K_500K", ResourceType = typeof(Resources.AnnualIncome))]
_200K_500K = 6,
[Custom(Name = "_2_5K_3_8K", ResourceType = typeof(Resources.AnnualIncome))]
_2_5K_3_8K = 6,

[Custom(Name = "_600K_1M", ResourceType = typeof(Resources.AnnualIncome))]
_600K_1M = 7,
[Custom(Name = "_3_8K_5_7K", ResourceType = typeof(Resources.AnnualIncome))]
_3_8K_5_7K = 7,

[Custom(Name = "_2M_5M", ResourceType = typeof(Resources.AnnualIncome))]
_2M_5M = 8,
[Custom(Name = "_5_7K_8_5K", ResourceType = typeof(Resources.AnnualIncome))]
_5_7K_8_5K = 8,

[Custom(Name = "_6M_10M", ResourceType = typeof(Resources.AnnualIncome))]
_6M_10M = 9,
[Custom(Name = "_8_5K_12_8K", ResourceType = typeof(Resources.AnnualIncome))]
_8_5K_12_8K = 9,

[Custom(Name = "_20M", ResourceType = typeof(Resources.AnnualIncome))]
_20M = 10
[Custom(Name = "_12_8K_19_2K", ResourceType = typeof(Resources.AnnualIncome))]
_12_8K_19_2K = 10,

[Custom(Name = "_19_2K_28_8K", ResourceType = typeof(Resources.AnnualIncome))]
_19_2K_28_8K = 11,

[Custom(Name = "_28_8K_43_2K", ResourceType = typeof(Resources.AnnualIncome))]
_28_8K_43_2K = 12,

[Custom(Name = "_43_2K_64_8K", ResourceType = typeof(Resources.AnnualIncome))]
_43_2K_64_8K = 13,

[Custom(Name = "_64_8K_97_3K", ResourceType = typeof(Resources.AnnualIncome))]
_64_8K_97_3K = 14,

[Custom(Name = "_97_3K_145_9K", ResourceType = typeof(Resources.AnnualIncome))]
_97_3K_145_9K = 15,

[Custom(Name = "_145_9K_218_9K", ResourceType = typeof(Resources.AnnualIncome))]
_145_9K_218_9K = 16,

[Custom(Name = "_218_9K", ResourceType = typeof(Resources.AnnualIncome))]
_218_9K = 17,
}
}
20 changes: 10 additions & 10 deletions MM.Shared/Enums/BodyType.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
namespace MM.Shared.Enums
{
public enum BodyMass
public enum BodyType
{
[Custom(Name = "UnderWeight", ResourceType = typeof(Resources.BodyMass))]
UnderWeight = 1,
[Custom(Name = "Thin / Slender")]
Slim = 1,

[Custom(Name = "NormalWeight", ResourceType = typeof(Resources.BodyMass))]
NormalWeight = 2,
[Custom(Name = "Average / Medium Build")]
Average = 2,

[Custom(Name = "Athletic", ResourceType = typeof(Resources.BodyMass))]
[Custom(Name = "Athletic / Fit")]
Athletic = 3,

[Custom(Name = "OverWeight", ResourceType = typeof(Resources.BodyMass))]
OverWeight = 4,
[Custom(Name = "Curvy / Plus Size")]
Curvy = 4,

[Custom(Name = "Obese", ResourceType = typeof(Resources.BodyMass))]
Obese = 5,
[Custom(Name = "Fuller Figure")]
Full = 5,
}
}
14 changes: 14 additions & 0 deletions MM.Shared/Enums/ConflictResolutionStyle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace MM.Shared.Enums
{
public enum ConflictResolutionStyle
{
[Custom(Name = "Direct Resolution", Description = "Prefers to discuss and resolve conflicts immediately and openly.")]
DirectResolution = 1,

[Custom(Name = "Reflective Approach", Description = "Takes time to think and reflect before addressing conflicts.")]
ReflectiveApproach = 2,

[Custom(Name = "Avoidance/Denial", Description = "Tends to avoid conflicts or overlook their existence altogether.")]
AvoidanceDenial = 3,
}
}
Loading

0 comments on commit 37763ee

Please sign in to comment.