Skip to content

Commit

Permalink
Merge pull request #8 from scogliera/feature/add_models
Browse files Browse the repository at this point in the history
Přidané modely objektů
  • Loading branch information
scogliera authored Dec 9, 2023
2 parents 13703a0 + 9315b78 commit 92fffd6
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Models/ContactInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace TeacherDigitalAgency.Models;

public class ContactInfo
{
[JsonPropertyName("telephone_numbers")] public required HashSet<string> TelephoneNumbers { get; set; }
[JsonPropertyName("emails")] public required HashSet<string> Emails { get; set; }
}
9 changes: 9 additions & 0 deletions Models/Error.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace TeacherDigitalAgency.Models;

public class Error
{
[JsonPropertyName("code")] public required int Code { get; set; }
[JsonPropertyName("message")] public required string Message { get; set; }
}
27 changes: 27 additions & 0 deletions Models/Lecturer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Text.Json.Serialization;

namespace TeacherDigitalAgency.Models;

public class Lecturer
{
public Lecturer(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}

[JsonPropertyName("uuid")] public Guid Uuid { get; init; } = Guid.NewGuid();
[JsonPropertyName("title_before")] public string? TitleBefore { get; set; }
[JsonPropertyName("first_name")] public required string FirstName { get; set; }
[JsonPropertyName("middle_name")] public string? MiddleName { get; set; }
[JsonPropertyName("last_name")] public required string LastName { get; set; }
[JsonPropertyName("title_after")] public string? TitleAfter { get; set; }
[JsonPropertyName("picture_url")] public string? PictureUrl { get; set; }
[JsonPropertyName("location")] public string? Location { get; set; }
[JsonPropertyName("claim")] public string? Claim { get; set; }
[JsonPropertyName("bio")] public string? Bio { get; set; }
[JsonPropertyName("tags")] public IEnumerable<Tag> Tags { get; set; } = new List<Tag>();
[JsonPropertyName("price_per_hour")] public int? PricePerHour { get; set; }
// TODO: Not known if contact can be nullable - most likely yes
[JsonPropertyName("contact")] public ContactInfo? ContactInfo { get; set; }
}
9 changes: 9 additions & 0 deletions Models/Tag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace TeacherDigitalAgency.Models;

public class Tag
{
[JsonPropertyName("uuid")] public Guid Uuid { get; init; } = Guid.NewGuid();
[JsonPropertyName("name")] public required string Name { get; set; }
}

0 comments on commit 92fffd6

Please sign in to comment.