авторизация
This commit is contained in:
13
CyberBoom/DbContext/Achievment.cs
Normal file
13
CyberBoom/DbContext/Achievment.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
public class Achievment
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
}
|
47
CyberBoom/DbContext/ApplicationContext.cs
Normal file
47
CyberBoom/DbContext/ApplicationContext.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
public class ApplicationContext : IdentityDbContext<User>
|
||||
{
|
||||
public DbSet<Meeting> Meetings { get; set; }
|
||||
|
||||
public DbSet<Review> Reviews { get; set; }
|
||||
|
||||
public DbSet<Reaction> Reactions { get; set; }
|
||||
|
||||
public DbSet<UserWriteToMeting> UserWriteToMetings { get; set; }
|
||||
|
||||
public DbSet<Question> Questions { get; set; }
|
||||
|
||||
|
||||
public DbSet<Achievment> Achievments { get; set; }
|
||||
|
||||
public ApplicationContext(DbContextOptions<ApplicationContext> options)
|
||||
: base(options)
|
||||
{
|
||||
Database.EnsureCreated();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
builder.Entity<Meeting>().HasMany<Review>().WithOne().HasForeignKey(c => c.MeetingId);
|
||||
builder.Entity<Meeting>().HasMany<Question>().WithOne().HasForeignKey(c => c.MeetingId);
|
||||
|
||||
|
||||
|
||||
|
||||
builder.Entity<Reaction>().HasOne<User>().WithMany().HasForeignKey(c => c.UserId);
|
||||
builder.Entity<Review>().HasOne(c => c.User).WithMany().HasForeignKey(c => c.UserId);
|
||||
|
||||
builder.Entity<Question>().HasOne<Meeting>().WithMany().HasForeignKey(c => c.MeetingId);
|
||||
builder.Entity<Question>().HasOne(c => c.User).WithMany().HasForeignKey(c => c.UserId);
|
||||
|
||||
builder.Entity<Reaction>().HasOne<Question>().WithMany().HasForeignKey(c => c.QuestionId);
|
||||
|
||||
builder.Entity<Meeting>().HasMany<UserWriteToMeting>().WithOne().HasForeignKey(c => c.MeetingId);
|
||||
builder.Entity<UserWriteToMeting>().HasOne<User>().WithMany().HasForeignKey(c => c.UserId);
|
||||
|
||||
builder.Entity<Achievment>().HasOne<User>().WithMany().HasForeignKey(c => c.UserId);
|
||||
}
|
||||
}
|
31
CyberBoom/DbContext/Dtos/Meetings/PostMeetingDto.cs
Normal file
31
CyberBoom/DbContext/Dtos/Meetings/PostMeetingDto.cs
Normal file
@ -0,0 +1,31 @@
|
||||
public class PostMeetingDto
|
||||
{
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public string Theme { get; set; } = null!;
|
||||
|
||||
public string SpeakerName { get; set; } = null!;
|
||||
|
||||
public IEnumerable<IFormFile> SpeackerImage { get; set; } = null!;
|
||||
|
||||
public IEnumerable<IFormFile> PlaceImages { get; set; } = null!;
|
||||
|
||||
|
||||
public string Splecializations { get; set; } = null!;
|
||||
|
||||
public string Type { get; set; } = "онлайн/офлайн";
|
||||
|
||||
public string SpeakerTelephone { get; set; } = null!;
|
||||
|
||||
public string SpeakerEmail { get; set; } = null!;
|
||||
|
||||
public string Tags { get; set; } = null!;
|
||||
|
||||
public string Urls { get; set; } = null!;
|
||||
|
||||
public string PlaceAdress { get; set; } = null!;
|
||||
|
||||
public string Duration { get; set; } = null!;
|
||||
}
|
33
CyberBoom/DbContext/Dtos/Meetings/PutMeetingDto.cs
Normal file
33
CyberBoom/DbContext/Dtos/Meetings/PutMeetingDto.cs
Normal file
@ -0,0 +1,33 @@
|
||||
public class PutMeetingDto
|
||||
{
|
||||
public String Id { get; set; } = null!;
|
||||
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public string Theme { get; set; } = null!;
|
||||
|
||||
public string SpeakerName { get; set; } = null!;
|
||||
|
||||
public IEnumerable<IFormFile> SpeackerImage { get; set; } = null!;
|
||||
|
||||
public IEnumerable<IFormFile> PlaceImages { get; set; } = null!;
|
||||
|
||||
public string Splecializations { get; set; } = null!;
|
||||
|
||||
|
||||
public string Type { get; set; } = "онлайн/офлайн";
|
||||
|
||||
public string SpeakerTelephone { get; set; } = null!;
|
||||
|
||||
public string SpeakerEmail { get; set; } = null!;
|
||||
|
||||
public string Tags { get; set; } = null!;
|
||||
|
||||
public string Urls { get; set; } = null!;
|
||||
|
||||
public string PlaceAdress { get; set; } = null!;
|
||||
|
||||
public string Duration { get; set; } = null!;
|
||||
}
|
8
CyberBoom/DbContext/Dtos/Questions/PostQuestionDto.cs
Normal file
8
CyberBoom/DbContext/Dtos/Questions/PostQuestionDto.cs
Normal file
@ -0,0 +1,8 @@
|
||||
public class PostQuestionDto
|
||||
{
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public string MeetingId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
}
|
6
CyberBoom/DbContext/Dtos/Questions/PutQuestionDto.cs
Normal file
6
CyberBoom/DbContext/Dtos/Questions/PutQuestionDto.cs
Normal file
@ -0,0 +1,6 @@
|
||||
public class PutQuestionDto
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
}
|
9
CyberBoom/DbContext/Dtos/Reaction/PostReactionDto.cs
Normal file
9
CyberBoom/DbContext/Dtos/Reaction/PostReactionDto.cs
Normal file
@ -0,0 +1,9 @@
|
||||
public class PostReactionDto
|
||||
{
|
||||
|
||||
public string QuestionId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public bool IsLike { get; set; } = true;
|
||||
}
|
14
CyberBoom/DbContext/Dtos/Review/PostReviewDto.cs
Normal file
14
CyberBoom/DbContext/Dtos/Review/PostReviewDto.cs
Normal file
@ -0,0 +1,14 @@
|
||||
public class PostReviewDto
|
||||
{
|
||||
public String MeetingId { get; set; } = null!;
|
||||
|
||||
public String UserId { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public int Score { get; set; } = 0;
|
||||
|
||||
DateTime _date;
|
||||
|
||||
public DateTime Date { get => _date; set => _date = value.ToUniversalTime(); }
|
||||
}
|
12
CyberBoom/DbContext/Dtos/Review/PutReviewDto.cs
Normal file
12
CyberBoom/DbContext/Dtos/Review/PutReviewDto.cs
Normal file
@ -0,0 +1,12 @@
|
||||
public class PutReviewDto
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public int Score { get; set; } = 0;
|
||||
|
||||
DateTime _date;
|
||||
|
||||
public DateTime Date { get => _date; set => _date = value.ToUniversalTime(); }
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
public class PostUserWriteToMetingDto
|
||||
{
|
||||
public String UserId { get; set; } = null!;
|
||||
|
||||
public String MeetingId { get; set; } = null!;
|
||||
}
|
17
CyberBoom/DbContext/Dtos/User/StatsData.cs
Normal file
17
CyberBoom/DbContext/Dtos/User/StatsData.cs
Normal file
@ -0,0 +1,17 @@
|
||||
public class StatsData
|
||||
{
|
||||
public double Hours{ get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
public List<TagStats> StatsByTag { get; set; } = new List<TagStats>();
|
||||
|
||||
public class TagStats
|
||||
{
|
||||
public string Tag { get; set; } = null!;
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
public double Hours { get; set; }
|
||||
}
|
||||
}
|
12
CyberBoom/DbContext/Dtos/User/UserPost.cs
Normal file
12
CyberBoom/DbContext/Dtos/User/UserPost.cs
Normal file
@ -0,0 +1,12 @@
|
||||
public class UserPost
|
||||
{
|
||||
public IFormFile Avatar { get; set; } = null!;
|
||||
|
||||
public string Fio { get; set; } = null!;
|
||||
|
||||
public string Username { get; set; } = null!;
|
||||
|
||||
public string Specialities { get; set; } = null!;
|
||||
|
||||
public string TelegramBotUrl { get; set; } = null!;
|
||||
}
|
14
CyberBoom/DbContext/Dtos/User/UserPut.cs
Normal file
14
CyberBoom/DbContext/Dtos/User/UserPut.cs
Normal file
@ -0,0 +1,14 @@
|
||||
public class UserPut
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public IFormFile Avatar { get; set; } = null!;
|
||||
|
||||
public string Fio { get; set; } = null!;
|
||||
|
||||
public string Username { get; set; } = null!;
|
||||
|
||||
public string Specialities { get; set; } = null!;
|
||||
|
||||
public string TelegramBotUrl { get; set; } = null!;
|
||||
}
|
37
CyberBoom/DbContext/Meeting.cs
Normal file
37
CyberBoom/DbContext/Meeting.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
public class Meeting
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public String Id { get; set; } = null!;
|
||||
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public string Theme { get; set; } = null!;
|
||||
|
||||
public string SpeakerName { get; set; } = null!;
|
||||
|
||||
public string SpeackerImage { get; set; } = null!;
|
||||
|
||||
public string Splecializations { get; set; } = null!; //speacker specilization
|
||||
|
||||
|
||||
public string Type { get; set; } = "онлайн/офлайн";
|
||||
|
||||
public string SpeakerTelephone { get; set; } = null!;
|
||||
|
||||
|
||||
public string PlaceImages { get; set; } = null!;
|
||||
|
||||
public string SpeakerEmail { get; set; } = null!;
|
||||
|
||||
public string Tags { get; set; } = null!;
|
||||
|
||||
public string Urls { get; set; } = null!;
|
||||
|
||||
public string PlaceAdress { get; set; } = null!;
|
||||
|
||||
public string Duration { get; set; } = null!;
|
||||
}
|
15
CyberBoom/DbContext/Question.cs
Normal file
15
CyberBoom/DbContext/Question.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
public class Question
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public string MeetingId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
}
|
13
CyberBoom/DbContext/Reaction.cs
Normal file
13
CyberBoom/DbContext/Reaction.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
public class Reaction
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string QuestionId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public bool IsLike { get; set; } = true;
|
||||
}
|
21
CyberBoom/DbContext/Review.cs
Normal file
21
CyberBoom/DbContext/Review.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
public class Review
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string MeetingId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public int Score { get; set; } = 0;
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
DateTime _date;
|
||||
|
||||
public DateTime Date { get => _date; set => _date = value.ToUniversalTime(); }
|
||||
}
|
@ -1,7 +1,4 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
public class User : IdentityUser
|
||||
@ -18,341 +15,3 @@ public class User : IdentityUser
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class UserPost
|
||||
{
|
||||
public IFormFile Avatar { get; set; } = null!;
|
||||
|
||||
public string Fio { get; set; } = null!;
|
||||
|
||||
public string Username { get; set; } = null!;
|
||||
|
||||
public string Specialities { get; set; } = null!;
|
||||
|
||||
public string TelegramBotUrl { get; set; } = null!;
|
||||
}
|
||||
|
||||
public class StatsData
|
||||
{
|
||||
public double Hours{ get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
public List<TagStats> StatsByTag { get; set; } = new List<TagStats>();
|
||||
|
||||
public class TagStats
|
||||
{
|
||||
public string Tag { get; set; } = null!;
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
public double Hours { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class UserPut
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public IFormFile Avatar { get; set; } = null!;
|
||||
|
||||
public string Fio { get; set; } = null!;
|
||||
|
||||
public string Username { get; set; } = null!;
|
||||
|
||||
public string Specialities { get; set; } = null!;
|
||||
|
||||
public string TelegramBotUrl { get; set; } = null!;
|
||||
}
|
||||
|
||||
public class PostMeetingDto
|
||||
{
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public string Theme { get; set; } = null!;
|
||||
|
||||
public string SpeakerName { get; set; } = null!;
|
||||
|
||||
public IEnumerable<IFormFile> SpeackerImage { get; set; } = null!;
|
||||
|
||||
public IEnumerable<IFormFile> PlaceImages { get; set; } = null!;
|
||||
|
||||
|
||||
public string Splecializations { get; set; } = null!;
|
||||
|
||||
public string Type { get; set; } = "онлайн/офлайн";
|
||||
|
||||
public string SpeakerTelephone { get; set; } = null!;
|
||||
|
||||
public string SpeakerEmail { get; set; } = null!;
|
||||
|
||||
public string Tags { get; set; } = null!;
|
||||
|
||||
public string Urls { get; set; } = null!;
|
||||
|
||||
public string PlaceAdress { get; set; } = null!;
|
||||
|
||||
public string Duration { get; set; } = null!;
|
||||
}
|
||||
|
||||
|
||||
public class UserWriteToMeting
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public String Id { get; set; } = null!;
|
||||
|
||||
public String UserId { get; set; } = null!;
|
||||
|
||||
public String MeetingId { get; set; } = null!;
|
||||
}
|
||||
|
||||
|
||||
public class PostUserWriteToMetingDto
|
||||
{
|
||||
public String UserId { get; set; } = null!;
|
||||
|
||||
public String MeetingId { get; set; } = null!;
|
||||
}
|
||||
|
||||
|
||||
public class PutMeetingDto
|
||||
{
|
||||
public String Id { get; set; } = null!;
|
||||
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public string Theme { get; set; } = null!;
|
||||
|
||||
public string SpeakerName { get; set; } = null!;
|
||||
|
||||
public IEnumerable<IFormFile> SpeackerImage { get; set; } = null!;
|
||||
|
||||
public IEnumerable<IFormFile> PlaceImages { get; set; } = null!;
|
||||
|
||||
public string Splecializations { get; set; } = null!;
|
||||
|
||||
|
||||
public string Type { get; set; } = "онлайн/офлайн";
|
||||
|
||||
public string SpeakerTelephone { get; set; } = null!;
|
||||
|
||||
public string SpeakerEmail { get; set; } = null!;
|
||||
|
||||
public string Tags { get; set; } = null!;
|
||||
|
||||
public string Urls { get; set; } = null!;
|
||||
|
||||
public string PlaceAdress { get; set; } = null!;
|
||||
|
||||
public string Duration { get; set; } = null!;
|
||||
}
|
||||
|
||||
|
||||
public class Meeting
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public String Id { get; set; } = null!;
|
||||
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public string Theme { get; set; } = null!;
|
||||
|
||||
public string SpeakerName { get; set; } = null!;
|
||||
|
||||
public string SpeackerImage { get; set; } = null!;
|
||||
|
||||
public string Splecializations { get; set; } = null!; //speacker specilization
|
||||
|
||||
|
||||
public string Type { get; set; } = "онлайн/офлайн";
|
||||
|
||||
public string SpeakerTelephone { get; set; } = null!;
|
||||
|
||||
|
||||
public string PlaceImages { get; set; } = null!;
|
||||
|
||||
public string SpeakerEmail { get; set; } = null!;
|
||||
|
||||
public string Tags { get; set; } = null!;
|
||||
|
||||
public string Urls { get; set; } = null!;
|
||||
|
||||
public string PlaceAdress { get; set; } = null!;
|
||||
|
||||
public string Duration { get; set; } = null!;
|
||||
}
|
||||
|
||||
|
||||
public class PostReviewDto
|
||||
{
|
||||
public String MeetingId { get; set; } = null!;
|
||||
|
||||
public String UserId { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public int Score { get; set; } = 0;
|
||||
|
||||
DateTime _date;
|
||||
|
||||
public DateTime Date { get => _date; set => _date = value.ToUniversalTime(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class PutReviewDto
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public int Score { get; set; } = 0;
|
||||
|
||||
DateTime _date;
|
||||
|
||||
public DateTime Date { get => _date; set => _date = value.ToUniversalTime(); }
|
||||
}
|
||||
|
||||
|
||||
public class PostQuestionDto
|
||||
{
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public string MeetingId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
}
|
||||
|
||||
|
||||
public class PutQuestionDto
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
}
|
||||
|
||||
public class Question
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public string MeetingId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
}
|
||||
|
||||
|
||||
public class Review
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string MeetingId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
|
||||
public int Score { get; set; } = 0;
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
DateTime _date;
|
||||
|
||||
public DateTime Date { get => _date; set => _date = value.ToUniversalTime(); }
|
||||
}
|
||||
|
||||
|
||||
public class Achievment
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public string Text { get; set; } = null!;
|
||||
}
|
||||
|
||||
|
||||
public class PostReactionDto
|
||||
{
|
||||
|
||||
public string QuestionId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public bool IsLike { get; set; } = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class Reaction
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string QuestionId { get; set; } = null!;
|
||||
|
||||
public string UserId { get; set; } = null!;
|
||||
|
||||
public bool IsLike { get; set; } = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class ApplicationContext : IdentityDbContext<User>
|
||||
{
|
||||
public DbSet<Meeting> Meetings { get; set; }
|
||||
|
||||
public DbSet<Review> Reviews { get; set; }
|
||||
|
||||
public DbSet<Reaction> Reactions { get; set; }
|
||||
|
||||
public DbSet<UserWriteToMeting> UserWriteToMetings { get; set; }
|
||||
|
||||
public DbSet<Question> Questions { get; set; }
|
||||
|
||||
|
||||
public DbSet<Achievment> Achievments { get; set; }
|
||||
|
||||
public ApplicationContext(DbContextOptions<ApplicationContext> options)
|
||||
: base(options)
|
||||
{
|
||||
Database.EnsureCreated();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
builder.Entity<Meeting>().HasMany<Review>().WithOne().HasForeignKey(c => c.MeetingId);
|
||||
builder.Entity<Meeting>().HasMany<Question>().WithOne().HasForeignKey(c => c.MeetingId);
|
||||
|
||||
|
||||
|
||||
|
||||
builder.Entity<Reaction>().HasOne<User>().WithMany().HasForeignKey(c => c.UserId);
|
||||
builder.Entity<Review>().HasOne(c => c.User).WithMany().HasForeignKey(c => c.UserId);
|
||||
|
||||
builder.Entity<Question>().HasOne<Meeting>().WithMany().HasForeignKey(c => c.MeetingId);
|
||||
builder.Entity<Question>().HasOne(c => c.User).WithMany().HasForeignKey(c => c.UserId);
|
||||
|
||||
builder.Entity<Reaction>().HasOne<Question>().WithMany().HasForeignKey(c => c.QuestionId);
|
||||
|
||||
builder.Entity<Meeting>().HasMany<UserWriteToMeting>().WithOne().HasForeignKey(c => c.MeetingId);
|
||||
builder.Entity<UserWriteToMeting>().HasOne<User>().WithMany().HasForeignKey(c => c.UserId);
|
||||
|
||||
builder.Entity<Achievment>().HasOne<User>().WithMany().HasForeignKey(c => c.UserId);
|
||||
}
|
||||
}
|
11
CyberBoom/DbContext/UserWriteToMeting.cs
Normal file
11
CyberBoom/DbContext/UserWriteToMeting.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
public class UserWriteToMeting
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public String Id { get; set; } = null!;
|
||||
|
||||
public String UserId { get; set; } = null!;
|
||||
|
||||
public String MeetingId { get; set; } = null!;
|
||||
}
|
Reference in New Issue
Block a user