-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reservation #2
Reservation #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik vind dat je het goed gedaan hebt, voor zover ik kan zien zit alles uit Trello erin verwerkt, en ben je niks vergeten. IK heb het nog niet functioneel getest maar qua code ziet het er in orde uit en zie ik geen bugs. Kijk nog wel even naar mijn 2 comments over de naam van de class en over de documentatie. Sommige dingen zijn duidelijker dan anderen en niet alles hoeft comments te hebben. Netjes gedaan!
ProjectB/Tour.cs
Outdated
public string Location { get; set; } // Location of the tour | ||
public int Capacity { get; set; } // Maximum capacity of the tour | ||
public int ParticipantsCount { get; set; } // Number of participants signed up for the tour | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deze comments voor de aangemaakte fields zijn niet nodig, aangezien de namen van de fields al duidelijk genoeg aangeven waarvoor het is
ProjectB/Reservation.cs
Outdated
using System.Linq; | ||
using System.Text.Json; | ||
|
||
class Program |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik denk dat het beter is als deze class Reservation heet en niet program
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nog wat dingen die eventueel anders kunnen. Als je daar hulp bij wil, kunnen we er even doorheen lopen.
Nu kan je alleen de tours zien die later zijn dan de tijd van nu.
Changes class program to Reservation
changed participantcount to Icollection<participant>
Removed datetime from participants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vergeet niet om testen te schrijven.
ProjectB/Models/AbstractUser.cs
Outdated
|
||
/// <summary> | ||
/// Blueprint for users, containing the fields shared by all user types. This class should be implemented by sub-classes, | ||
/// which specify the type of user, and implement unique functionality and fields based on that type. | ||
/// </summary> | ||
/// <param name="username">The username assigned to the user.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er zijn een aantal van mijn comments weggevallen tijdens je commits. Zou je die weer terug willen plaatsen?
|
||
/// <summary> | ||
/// Blueprint for users, containing the fields shared by all user types. This class should be implemented by sub-classes, | ||
/// which specify the type of user, and implement unique functionality and fields based on that type. | ||
/// </summary> | ||
/// <param name="username">The username assigned to the user.</param> | ||
/// <param name="role">The role assigned to a user, used to determine what functionality should be available to said user.</param> | ||
public abstract class AbstractUser(string username, UserRole role) : IEquatable<AbstractUser>, IEntity<string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deze wijziging is niet nodig.
ProjectB/Models/AbstractUser.cs
Outdated
[JsonProperty] protected readonly string Username; | ||
[JsonProperty] protected readonly UserRole Role; | ||
|
||
public AbstractUser(string username, UserRole role) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aparte constructor is niet nodig, omdat we die effectief al definiëren direct naar de naam van de class.
ProjectB/Models/AbstractUser.cs
Outdated
@@ -65,9 +68,10 @@ public override int GetHashCode() | |||
private class Builder | |||
{ | |||
private string? _username; | |||
private string? _password; | |||
private int _ticketNumber; // Add ticketNumber field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Een apart ticket-number field is niet nodig. We kunnen de _username gewoon gebruiken.
/// UserRole.Guest, the password will be ignored. | ||
/// </summary> | ||
/// <param name="password">The password that will be set.</param> | ||
/// <returns>This instance of the Builder.</returns> | ||
public Builder WithPassword(string password) | ||
{ | ||
_password = BCrypt.EnhancedHashPassword(password); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gelieve wel weer EnhancedHashPassword gebruiken. Anders werkt de verification ook niet meer.
public bool IsValid() => _validForDate.CompareTo(DateTime.Today) == 0; | ||
|
||
public override bool Equals(AbstractUser? other) | ||
public class Guest : AbstractUser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Het wijzigen van de constructor is niet nodig, omdat ticketnumber geen nieuwe field hoeft te zijn. Gebruik username daarvoor.
|
||
public class JsonFileReader<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We hebben al een class ProjectB.IO.JsonFileReader. Die kun je gebruiken, zodat we niet dit soort code door het hele project hebben slingeren.
|
||
public RondleidingService(JsonFileReader jsonFileReader) | ||
public RondleidingService(JsonFileReader<Tour> jsonFileReader) // Adjust the constructor parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In plaats van de data pas in te lezen wanneer je een rondleiding wil laten zien, kun je dat eigenlijk al direct doen wanneer het RondleidingService-object gemaakt wordt. Zou je in de constructor kunnen doen.
for (int i = 0; i < amount; i++) | ||
{ | ||
// Generate a unique ticket number for each guest | ||
int ticketNumber = i + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ticketNumber is hier ook niet meer nodig.
No description provided.