Skip to content

Commit 88c1ff2

Browse files
authored
Merge pull request #54 from Adel-Atzouza/Adel
fix models
2 parents 0c71d43 + 267c47b commit 88c1ff2

File tree

2 files changed

+25
-43
lines changed

2 files changed

+25
-43
lines changed

CargoHub/Models/Supplier.cs

+13-12
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,35 @@ public class Supplier : BaseModel, IContainsClassification
66
{
77
[JsonPropertyName("code")]
88

9-
public string? Code { get; set; }
9+
public required string? Code { get; set; }
1010
[JsonPropertyName("name")]
1111

12-
public string? Name { get; set; }
12+
public required string? Name { get; set; }
1313
[JsonPropertyName("address")]
1414

15-
public string? Address { get; set; }
15+
public required string? Address { get; set; }
1616
[JsonPropertyName("address_extra")]
17-
public string? AddressExtra { get; set; }
17+
public required string? AddressExtra { get; set; }
1818
[JsonPropertyName("city")]
19-
public string? City { get; set; }
19+
public required string? City { get; set; }
2020
[JsonPropertyName("zip_code")]
21-
public string? ZipCode { get; set; }
21+
public required string? ZipCode { get; set; }
2222
[JsonPropertyName("province")]
2323

24-
public string? Province { get; set; }
24+
public required string? Province { get; set; }
2525
[JsonPropertyName("country")]
2626

27-
public string? Country { get; set; }
27+
public required string? Country { get; set; }
2828

2929
[JsonPropertyName("contact_name")]
30-
public string? ContactName { get; set; }
30+
public required string? ContactName { get; set; }
3131
[JsonPropertyName("phonenumber")]
3232

33-
public string? Phonenumber { get; set; }
33+
public required string? Phonenumber { get; set; }
3434
[JsonPropertyName("reference")]
3535

36-
public string? Reference { get; set; }
36+
public required string? Reference { get; set; }
3737
[JsonIgnore]
3838
public List<Classification> Classifications { get; set; } = [];
39-
}
39+
}
40+
}

CargoHub/Models/Warehouse.cs

+12-31
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,21 @@ namespace CargoHub.Models
55
{
66
public class Warehouse : BaseModel, IContainsClassification
77
{
8-
[JsonPropertyName("code")]
9-
10-
public string? Code { get; set; }
11-
[JsonPropertyName("name")]
12-
13-
public string? Name { get; set; }
14-
[JsonPropertyName("address")]
15-
16-
public string? Address { get; set; }
17-
[JsonPropertyName("zip")]
18-
19-
public string? Zip { get; set; }
20-
[JsonPropertyName("city")]
21-
22-
public string? City { get; set; }
23-
[JsonPropertyName("province")]
24-
25-
public string? Province { get; set; }
26-
[JsonPropertyName("country")]
27-
28-
public string? Country { get; set; }
8+
public required string Code { get; set; }
9+
public required string Name { get; set; }
10+
public required string Address { get; set; }
11+
public required string Zip { get; set; }
12+
public required string City { get; set; }
13+
public required string Province { get; set; }
14+
public required string Country { get; set; }
2915
[JsonIgnore]
30-
public string? ContactName { get; set; }
16+
public string ContactName { get; set; } = string.Empty;
3117

3218
[JsonIgnore]
33-
public string? ContactPhone { get; set; }
19+
public string ContactPhone { get; set; } = string.Empty;
3420

3521
[JsonIgnore]
36-
public string? ContactEmail { get; set; }
22+
public string ContactEmail { get; set; } = string.Empty;
3723

3824
[NotMapped]
3925
// Contact dictionary for JSON serialization/deserialization
@@ -58,14 +44,9 @@ public class Warehouse : BaseModel, IContainsClassification
5844
}
5945
}
6046

61-
47+
[JsonIgnore]
48+
public ICollection<Location> Locations { get; } = [];
6249
[JsonIgnore]
6350
public List<Classification> Classifications { get; set; } = [];
64-
// Metadata
65-
[JsonPropertyName("created_at")]
66-
public DateTime CreatedAt { get; set; }
67-
68-
// [JsonPropertyName("updated_at")]
69-
// public DateTime UpdatedAt { get; set; }
7051
}
7152
}

0 commit comments

Comments
 (0)