Skip to content

Commit 1f43ce7

Browse files
committed
regenerate models, now also with attributes
1 parent 8c6f6f0 commit 1f43ce7

12 files changed

Lines changed: 193 additions & 233 deletions

PlotSystem-API/Models/BuildTeam.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
using System.ComponentModel.DataAnnotations;
2+
using System.ComponentModel.DataAnnotations.Schema;
3+
using Microsoft.EntityFrameworkCore;
24

35
namespace PlotSystem_API.Models;
46

7+
[Table("build_team")]
8+
[Index("ApiKey", Name = "api_key", IsUnique = true)]
59
public partial class BuildTeam
610
{
11+
[Key]
12+
[Column("build_team_id", TypeName = "int(11)")]
713
public int BuildTeamId { get; set; }
814

15+
[Column("name")]
16+
[StringLength(255)]
917
public string Name { get; set; } = null!;
1018

11-
[MaxLength(255)]
19+
[Column("api_key")]
1220
public string? ApiKey { get; set; }
1321

22+
[Column("api_create_date", TypeName = "datetime")]
1423
public DateTime? ApiCreateDate { get; set; }
1524

25+
[InverseProperty("BuildTeam")]
1626
public virtual ICollection<CityProject> CityProjects { get; set; } = new List<CityProject>();
1727

28+
[InverseProperty("BuildTeam")]
1829
public virtual ICollection<Server> Servers { get; set; } = new List<Server>();
1930

31+
[ForeignKey("BuildTeamId")]
32+
[InverseProperty("BuildTeams")]
2033
public virtual ICollection<ReviewToggleCriterion> CriteriaNames { get; set; } = new List<ReviewToggleCriterion>();
2134

35+
[ForeignKey("BuildTeamId")]
36+
[InverseProperty("BuildTeams")]
2237
public virtual ICollection<Builder> Uus { get; set; } = new List<Builder>();
2338
}

PlotSystem-API/Models/Builder.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,48 @@
11
using System.ComponentModel.DataAnnotations;
2+
using System.ComponentModel.DataAnnotations.Schema;
3+
using Microsoft.EntityFrameworkCore;
24

35
namespace PlotSystem_API.Models;
46

7+
[Table("builder")]
8+
[Index("Name", Name = "name", IsUnique = true)]
59
public partial class Builder
610
{
11+
[Key]
12+
[Column("uuid")]
13+
[StringLength(36)]
714
public string Uuid { get; set; } = null!;
815

9-
[MaxLength(255)]
16+
[Column("name")]
1017
public string Name { get; set; } = null!;
1118

19+
[Column("score", TypeName = "int(11)")]
1220
public int Score { get; set; }
1321

22+
[Column("first_slot", TypeName = "int(11)")]
1423
public int? FirstSlot { get; set; }
1524

25+
[Column("second_slot", TypeName = "int(11)")]
1626
public int? SecondSlot { get; set; }
1727

28+
[Column("third_slot", TypeName = "int(11)")]
1829
public int? ThirdSlot { get; set; }
1930

31+
[Column("plot_type", TypeName = "int(11)")]
2032
public int PlotType { get; set; }
2133

34+
[InverseProperty("OwnerUu")]
2235
public virtual ICollection<Plot> PlotsNavigation { get; set; } = new List<Plot>();
2336

37+
[ForeignKey("Uuid")]
38+
[InverseProperty("Uus")]
2439
public virtual ICollection<BuildTeam> BuildTeams { get; set; } = new List<BuildTeam>();
2540

41+
[ForeignKey("Uuid")]
42+
[InverseProperty("Uus")]
2643
public virtual ICollection<Plot> Plots { get; set; } = new List<Plot>();
2744

45+
[ForeignKey("Uuid")]
46+
[InverseProperty("Uus")]
2847
public virtual ICollection<PlotReview> Reviews { get; set; } = new List<PlotReview>();
2948
}
Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,45 @@
11
using System.ComponentModel.DataAnnotations;
2+
using System.ComponentModel.DataAnnotations.Schema;
3+
using Microsoft.EntityFrameworkCore;
24

35
namespace PlotSystem_API.Models;
46

7+
[Table("city_project")]
8+
[Index("BuildTeamId", Name = "build_team_id")]
9+
[Index("CountryCode", Name = "country_code")]
10+
[Index("ServerName", Name = "server_name")]
511
public partial class CityProject
612
{
7-
[MaxLength(255)]
13+
[Key]
14+
[Column("city_project_id")]
815
public string CityProjectId { get; set; } = null!;
916

17+
[Column("build_team_id", TypeName = "int(11)")]
1018
public int BuildTeamId { get; set; }
1119

20+
[Column("country_code")]
21+
[StringLength(2)]
1222
public string CountryCode { get; set; } = null!;
1323

14-
[MaxLength(255)]
24+
[Column("server_name")]
1525
public string ServerName { get; set; } = null!;
1626

27+
[Required]
28+
[Column("is_visible")]
1729
public bool IsVisible { get; set; }
1830

31+
[ForeignKey("BuildTeamId")]
32+
[InverseProperty("CityProjects")]
1933
public virtual BuildTeam BuildTeam { get; set; } = null!;
2034

35+
[ForeignKey("CountryCode")]
36+
[InverseProperty("CityProjects")]
2137
public virtual Country CountryCodeNavigation { get; set; } = null!;
2238

39+
[InverseProperty("CityProject")]
2340
public virtual ICollection<Plot> Plots { get; set; } = new List<Plot>();
2441

42+
[ForeignKey("ServerName")]
43+
[InverseProperty("CityProjects")]
2544
public virtual Server ServerNameNavigation { get; set; } = null!;
2645
}

PlotSystem-API/Models/Country.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
using System.ComponentModel.DataAnnotations;
2+
using System.ComponentModel.DataAnnotations.Schema;
23

34
namespace PlotSystem_API.Models;
45

6+
[Table("country")]
57
public partial class Country
68
{
9+
[Key]
10+
[Column("country_code")]
11+
[StringLength(2)]
712
public string CountryCode { get; set; } = null!;
813

9-
[MaxLength(2)]
14+
[Column("continent", TypeName = "enum('EU','AS','AF','OC','SA','NA')")]
1015
public string Continent { get; set; } = null!;
1116

17+
[Column("material")]
18+
[StringLength(255)]
1219
public string Material { get; set; } = null!;
1320

21+
[Column("custom_model_data")]
22+
[StringLength(255)]
1423
public string? CustomModelData { get; set; }
1524

25+
[InverseProperty("CountryCodeNavigation")]
1626
public virtual ICollection<CityProject> CityProjects { get; set; } = new List<CityProject>();
1727
}

PlotSystem-API/Models/Plot.cs

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,80 @@
11
using System.ComponentModel.DataAnnotations;
2+
using System.ComponentModel.DataAnnotations.Schema;
3+
using Microsoft.EntityFrameworkCore;
24

35
namespace PlotSystem_API.Models;
46

7+
[Table("plot")]
8+
[Index("CityProjectId", Name = "city_project_id")]
9+
[Index("DifficultyId", Name = "difficulty_id")]
10+
[Index("OwnerUuid", Name = "owner_uuid")]
511
public partial class Plot
612
{
13+
[Key]
14+
[Column("plot_id", TypeName = "int(11)")]
715
public int PlotId { get; set; }
816

9-
[MaxLength(255)]
17+
[Column("city_project_id")]
1018
public string CityProjectId { get; set; } = null!;
1119

12-
[MaxLength(255)]
20+
[Column("difficulty_id")]
1321
public string DifficultyId { get; set; } = null!;
1422

23+
[Column("owner_uuid")]
24+
[StringLength(36)]
1525
public string? OwnerUuid { get; set; }
1626

17-
[MaxLength(255)]
27+
[Column("status", TypeName = "enum('unclaimed','unfinished','unreviewed','completed')")]
1828
public string Status { get; set; } = null!;
1929

20-
public int? Score { get; set; }
21-
30+
[Column("outline_bounds", TypeName = "text")]
2231
public string OutlineBounds { get; set; } = null!;
2332

33+
[Column("initial_schematic", TypeName = "mediumblob")]
2434
public byte[] InitialSchematic { get; set; } = null!;
2535

36+
[Column("complete_schematic", TypeName = "mediumblob")]
2637
public byte[]? CompleteSchematic { get; set; }
2738

39+
[Column("last_activity_date", TypeName = "datetime")]
2840
public DateTime? LastActivityDate { get; set; }
2941

42+
[Column("is_pasted")]
3043
public bool IsPasted { get; set; }
3144

45+
[Column("mc_version")]
46+
[StringLength(8)]
3247
public string? McVersion { get; set; }
3348

49+
[Column("plot_version")]
3450
public double PlotVersion { get; set; }
3551

52+
[Column("plot_type", TypeName = "int(11)")]
3653
public int PlotType { get; set; }
3754

55+
[Column("created_by")]
56+
[StringLength(36)]
3857
public string CreatedBy { get; set; } = null!;
3958

59+
[Column("create_date", TypeName = "datetime")]
4060
public DateTime CreateDate { get; set; }
4161

62+
[ForeignKey("CityProjectId")]
63+
[InverseProperty("Plots")]
4264
public virtual CityProject CityProject { get; set; } = null!;
4365

66+
[ForeignKey("DifficultyId")]
67+
[InverseProperty("Plots")]
4468
public virtual PlotDifficulty Difficulty { get; set; } = null!;
4569

70+
[ForeignKey("OwnerUuid")]
71+
[InverseProperty("PlotsNavigation")]
4672
public virtual Builder? OwnerUu { get; set; }
4773

74+
[InverseProperty("Plot")]
4875
public virtual ICollection<PlotReview> PlotReviews { get; set; } = new List<PlotReview>();
4976

77+
[ForeignKey("PlotId")]
78+
[InverseProperty("Plots")]
5079
public virtual ICollection<Builder> Uus { get; set; } = new List<Builder>();
5180
}
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
using System.ComponentModel.DataAnnotations;
2+
using System.ComponentModel.DataAnnotations.Schema;
3+
using Microsoft.EntityFrameworkCore;
24

35
namespace PlotSystem_API.Models;
46

7+
[Table("plot_difficulty")]
58
public partial class PlotDifficulty
69
{
7-
[MaxLength(255)]
10+
[Key]
11+
[Column("difficulty_id")]
812
public string DifficultyId { get; set; } = null!;
913

14+
[Column("multiplier")]
15+
[Precision(4, 2)]
1016
public decimal? Multiplier { get; set; }
1117

18+
[Column("score_requirement", TypeName = "int(11)")]
1219
public int ScoreRequirement { get; set; }
1320

21+
[InverseProperty("Difficulty")]
1422
public virtual ICollection<Plot> Plots { get; set; } = new List<Plot>();
1523
}
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,44 @@
1-
namespace PlotSystem_API.Models;
1+
using System.ComponentModel.DataAnnotations;
2+
using System.ComponentModel.DataAnnotations.Schema;
3+
using Microsoft.EntityFrameworkCore;
24

5+
namespace PlotSystem_API.Models;
6+
7+
[Table("plot_review")]
8+
[Index("PlotId", Name = "plot_id")]
39
public partial class PlotReview
410
{
11+
[Key]
12+
[Column("review_id", TypeName = "int(11)")]
513
public int ReviewId { get; set; }
614

15+
[Column("plot_id", TypeName = "int(11)")]
716
public int PlotId { get; set; }
817

18+
[Column("rating")]
19+
[StringLength(7)]
920
public string Rating { get; set; } = null!;
1021

22+
[Column("feedback")]
23+
[StringLength(256)]
1124
public string? Feedback { get; set; }
1225

26+
[Column("reviewed_by")]
27+
[StringLength(36)]
1328
public string ReviewedBy { get; set; } = null!;
1429

30+
[Column("review_date", TypeName = "datetime")]
1531
public DateTime ReviewDate { get; set; }
1632

33+
[ForeignKey("PlotId")]
34+
[InverseProperty("PlotReviews")]
1735
public virtual Plot Plot { get; set; } = null!;
1836

37+
[ForeignKey("ReviewId")]
38+
[InverseProperty("Reviews")]
1939
public virtual ICollection<ReviewToggleCriterion> CriteriaNames { get; set; } = new List<ReviewToggleCriterion>();
2040

41+
[ForeignKey("ReviewId")]
42+
[InverseProperty("Reviews")]
2143
public virtual ICollection<Builder> Uus { get; set; } = new List<Builder>();
2244
}

0 commit comments

Comments
 (0)