Skip to content

Commit

Permalink
Changes as per sonarcloud recommendation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisIvanov committed Jun 17, 2024
1 parent 7e20238 commit 89abea4
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 83 deletions.
19 changes: 11 additions & 8 deletions src/server/CookingApp/Models/Allergy.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Allergy : MongoEntity
namespace CookingApp.Models
{
[BsonElement("name")]
public string Name { get; set; }
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Allergy : MongoEntity
{
[BsonElement("name")]
public string Name { get; set; }

[BsonElement("severity")]
public AllergySeverity Severity { get; set; }
[BsonElement("severity")]
public AllergySeverity Severity { get; set; }
}
}
11 changes: 7 additions & 4 deletions src/server/CookingApp/Models/AllergySeverity.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
public enum AllergySeverity
namespace CookingApp.Models
{
Mild,
Moderate,
Severe
public enum AllergySeverity
{
Mild,
Moderate,
Severe
}
}
35 changes: 19 additions & 16 deletions src/server/CookingApp/Models/Chat.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Chat : MongoEntity
namespace CookingApp.Models
{
[BsonElement("ApiGeneratedId")]
public string ApiGeneratedId { get; set; }
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Chat : MongoEntity
{
[BsonElement("ApiGeneratedId")]
public string ApiGeneratedId { get; set; }

[BsonElement("title")]
public string Title { get; set; }
[BsonElement("title")]
public string Title { get; set; }

[BsonElement("userId")]
public string UserId { get; set; }
[BsonElement("userId")]
public string UserId { get; set; }

[BsonElement("createdTime")]
public DateTime CreatedTime { get; set; }
[BsonElement("createdTime")]
public DateTime CreatedTime { get; set; }

[BsonElement("requests")]
public List<Request> Requests { get; set; } = new List<Request>();
[BsonElement("requests")]
public List<Request> Requests { get; set; } = new List<Request>();

[BsonElement("responses")]
public List<Response> Responses { get; set; } = new List<Response>();
[BsonElement("responses")]
public List<Response> Responses { get; set; } = new List<Response>();
}
}
11 changes: 7 additions & 4 deletions src/server/CookingApp/Models/DietaryPreference.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
public enum DietaryPreference
namespace CookingApp.Models
{
None,
Vegan,
Vegetarian
public enum DietaryPreference
{
None,
Vegan,
Vegetarian
}
}
19 changes: 11 additions & 8 deletions src/server/CookingApp/Models/Food.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Food : MongoEntity
namespace CookingApp.Models
{
[BsonElement("name")]
public string Name { get; set; }
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Food : MongoEntity
{
[BsonElement("name")]
public string Name { get; set; }

[BsonElement("type")]
public FoodType Type { get; set; }
[BsonElement("type")]
public FoodType Type { get; set; }
}
}
17 changes: 10 additions & 7 deletions src/server/CookingApp/Models/FoodType.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
public enum FoodType
namespace CookingApp.Models
{
Vegetable,
Fruit,
Grain,
Protein,
Dairy,
Other
public enum FoodType
{
Vegetable,
Fruit,
Grain,
Protein,
Dairy,
Other
}
}
21 changes: 12 additions & 9 deletions src/server/CookingApp/Models/Request.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Request : MongoEntity
namespace CookingApp.Models
{
[BsonElement("message")]
public string Message { get; set; }
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Request : MongoEntity
{
[BsonElement("message")]
public string Message { get; set; }

[BsonElement("timestamp")]
public DateTime Timestamp { get; set; }
}
[BsonElement("timestamp")]
public DateTime Timestamp { get; set; }
}
}
19 changes: 11 additions & 8 deletions src/server/CookingApp/Models/Response.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Response : MongoEntity
namespace CookingApp.Models
{
[BsonElement("message")]
public string Message { get; set; }
using CookingApp.Infrastructure.Common;
using MongoDB.Bson.Serialization.Attributes;

public class Response : MongoEntity
{
[BsonElement("message")]
public string Message { get; set; }

[BsonElement("timestamp")]
public DateTime Timestamp { get; set; }
[BsonElement("timestamp")]
public DateTime Timestamp { get; set; }
}
}
41 changes: 22 additions & 19 deletions src/server/CookingApp/Models/User.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson;
using System;
using CookingApp.Infrastructure.Common;

public class User : MongoEntity
namespace CookingApp.Models
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; }
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson;
using System;
using CookingApp.Infrastructure.Common;

public class User : MongoEntity
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; }

[BsonElement("name")]
public string Name { get; set; }
[BsonElement("name")]
public string Name { get; set; }

[BsonElement("dietaryPreference")]
public DietaryPreference DietaryPreference { get; set; }
[BsonElement("dietaryPreference")]
public DietaryPreference DietaryPreference { get; set; }

[BsonElement("allergies")]
public List<Allergy> Allergies { get; set; } = new List<Allergy>();
[BsonElement("allergies")]
public List<Allergy> Allergies { get; set; } = new List<Allergy>();

[BsonElement("avoidedFoods")]
public List<Food> AvoidedFoods { get; set; } = new List<Food>();
[BsonElement("avoidedFoods")]
public List<Food> AvoidedFoods { get; set; } = new List<Food>();

[BsonElement("chats")]
public List<Chat> Chats { get; set; } = new List<Chat>();
[BsonElement("chats")]
public List<Chat> Chats { get; set; } = new List<Chat>();
}
}

0 comments on commit 89abea4

Please sign in to comment.