@@ -17,6 +17,18 @@ public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
1717 /// <summary>User skill proficiency records.</summary>
1818 public DbSet < UserSkill > UserSkills => Set < UserSkill > ( ) ;
1919
20+ /// <summary>Projects requiring team assembly.</summary>
21+ public DbSet < Project > Projects => Set < Project > ( ) ;
22+
23+ /// <summary>Proposed or confirmed teams for projects.</summary>
24+ public DbSet < Team > Teams => Set < Team > ( ) ;
25+
26+ /// <summary>Team membership records linking users to teams.</summary>
27+ public DbSet < TeamMembership > TeamMemberships => Set < TeamMembership > ( ) ;
28+
29+ /// <summary>Raw LLM team recommendation audit records.</summary>
30+ public DbSet < Recommendation > Recommendations => Set < Recommendation > ( ) ;
31+
2032 protected override void OnModelCreating ( ModelBuilder modelBuilder )
2133 {
2234 base . OnModelCreating ( modelBuilder ) ;
@@ -43,5 +55,39 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
4355 e . HasOne ( us => us . User ) . WithMany ( ) . HasForeignKey ( us => us . UserId ) ;
4456 e . HasOne ( us => us . Skill ) . WithMany ( ) . HasForeignKey ( us => us . SkillId ) ;
4557 } ) ;
58+
59+ modelBuilder . Entity < Project > ( e =>
60+ {
61+ e . HasKey ( p => p . Id ) ;
62+ e . Property ( p => p . Title ) . IsRequired ( ) . HasMaxLength ( 256 ) ;
63+ e . Property ( p => p . Description ) . IsRequired ( ) ;
64+ e . Property ( p => p . Timeline ) . IsRequired ( ) . HasMaxLength ( 256 ) ;
65+ e . Property ( p => p . CreatedAt ) . IsRequired ( ) ;
66+ e . HasOne ( p => p . CreatedByUser ) . WithMany ( ) . HasForeignKey ( p => p . CreatedByUserId ) ;
67+ } ) ;
68+
69+ modelBuilder . Entity < Team > ( e =>
70+ {
71+ e . HasKey ( t => t . Id ) ;
72+ e . Property ( t => t . CreatedAt ) . IsRequired ( ) ;
73+ e . HasOne ( t => t . Project ) . WithMany ( ) . HasForeignKey ( t => t . ProjectId ) ;
74+ } ) ;
75+
76+ modelBuilder . Entity < TeamMembership > ( e =>
77+ {
78+ e . HasKey ( tm => tm . Id ) ;
79+ e . Property ( tm => tm . ProjectRole ) . IsRequired ( ) . HasMaxLength ( 256 ) ;
80+ e . HasOne ( tm => tm . Team ) . WithMany ( ) . HasForeignKey ( tm => tm . TeamId ) ;
81+ e . HasOne ( tm => tm . User ) . WithMany ( ) . HasForeignKey ( tm => tm . UserId ) ;
82+ } ) ;
83+
84+ modelBuilder . Entity < Recommendation > ( e =>
85+ {
86+ e . HasKey ( r => r . Id ) ;
87+ e . Property ( r => r . RawResponse ) . IsRequired ( ) . HasColumnType ( "jsonb" ) ;
88+ e . Property ( r => r . CreatedAt ) . IsRequired ( ) ;
89+ e . HasOne ( r => r . Project ) . WithMany ( ) . HasForeignKey ( r => r . ProjectId ) ;
90+ e . HasOne ( r => r . Team ) . WithMany ( ) . HasForeignKey ( r => r . TeamId ) ;
91+ } ) ;
4692 }
4793}
0 commit comments