Add OAth flow for Gmail and update tables and UI
This commit is contained in:
@@ -16,6 +16,7 @@ namespace JobTrackerApi.Data
|
||||
public DbSet<Company> Companies => Set<Company>();
|
||||
public DbSet<JobApplication> JobApplications => Set<JobApplication>();
|
||||
public DbSet<Correspondence> Correspondences => Set<Correspondence>();
|
||||
public DbSet<GmailConnection> GmailConnections => Set<GmailConnection>();
|
||||
public DbSet<Attachment> Attachments => Set<Attachment>();
|
||||
public DbSet<RuleSettings> RuleSettings => Set<RuleSettings>();
|
||||
public DbSet<UserRuleSettings> UserRuleSettings => Set<UserRuleSettings>();
|
||||
@@ -58,6 +59,16 @@ namespace JobTrackerApi.Data
|
||||
.HasForeignKey(c => c.JobApplicationId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<GmailConnection>()
|
||||
.HasQueryFilter(x => CurrentUserId == null || x.OwnerUserId == CurrentUserId);
|
||||
|
||||
modelBuilder.Entity<GmailConnection>()
|
||||
.HasIndex(x => new { x.OwnerUserId, x.GmailAddress })
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<GmailConnection>()
|
||||
.HasIndex(x => x.OwnerUserId);
|
||||
|
||||
modelBuilder.Entity<Attachment>()
|
||||
.HasOne(a => a.JobApplication)
|
||||
.WithMany(j => j.Attachments)
|
||||
|
||||
Reference in New Issue
Block a user