aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Data
diff options
context:
space:
mode:
authorKamen Mladenov <kamen.d.mladenov@protonmail.com>2021-04-09 19:51:35 +0300
committerGitHub <noreply@github.com>2021-04-09 19:51:35 +0300
commit233f38915ba0079079233eff55434ef349c05c45 (patch)
tree6c5f69017865bcab87355e910c87339453da1406 /src/DevHive.Data
parentf4a70c6430db923af9fa9958a11c2d6612cb52cc (diff)
parenta992357efcf1bc1ece81b95ecee5e05a0b73bfdc (diff)
downloadDevHive-0.2.tar
DevHive-0.2.tar.gz
DevHive-0.2.zip
Merge pull request #28 from Team-Kaleidoscope/devHEADv0.2mainheroku/main
Second stage: Complete
Diffstat (limited to 'src/DevHive.Data')
-rw-r--r--src/DevHive.Data/ConnectionString.json5
-rw-r--r--src/DevHive.Data/DevHive.Data.csproj30
-rw-r--r--src/DevHive.Data/DevHiveContext.cs115
-rw-r--r--src/DevHive.Data/DevHiveContextFactory.cs23
-rw-r--r--src/DevHive.Data/Interfaces/Models/IComment.cs16
-rw-r--r--src/DevHive.Data/Interfaces/Models/ILanguage.cs11
-rw-r--r--src/DevHive.Data/Interfaces/Models/IModel.cs9
-rw-r--r--src/DevHive.Data/Interfaces/Models/IPost.cs22
-rw-r--r--src/DevHive.Data/Interfaces/Models/IProfilePicture.cs13
-rw-r--r--src/DevHive.Data/Interfaces/Models/IRating.cs14
-rw-r--r--src/DevHive.Data/Interfaces/Models/IRole.cs10
-rw-r--r--src/DevHive.Data/Interfaces/Models/ITechnology.cs11
-rw-r--r--src/DevHive.Data/Interfaces/Models/IUser.cs21
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs16
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs13
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs17
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IPostRepository.cs19
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs13
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IRepository.cs21
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IRoleRepository.cs15
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs17
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IUserRepository.cs22
-rw-r--r--src/DevHive.Data/Migrations/20210205140955_rating.Designer.cs665
-rw-r--r--src/DevHive.Data/Migrations/20210205140955_rating.cs581
-rw-r--r--src/DevHive.Data/Migrations/20210205150447_Friends_Init_Config.Designer.cs643
-rw-r--r--src/DevHive.Data/Migrations/20210205150447_Friends_Init_Config.cs45
-rw-r--r--src/DevHive.Data/Migrations/20210205154810_PostFileAttachments.Designer.cs691
-rw-r--r--src/DevHive.Data/Migrations/20210205154810_PostFileAttachments.cs51
-rw-r--r--src/DevHive.Data/Migrations/20210205160520_Friends_First_Tweek.Designer.cs609
-rw-r--r--src/DevHive.Data/Migrations/20210205160520_Friends_First_Tweek.cs46
-rw-r--r--src/DevHive.Data/Migrations/DevHiveContextModelSnapshot.cs658
-rw-r--r--src/DevHive.Data/Models/Comment.cs20
-rw-r--r--src/DevHive.Data/Models/Language.cs15
-rw-r--r--src/DevHive.Data/Models/Post.cs26
-rw-r--r--src/DevHive.Data/Models/ProfilePicture.cs15
-rw-r--r--src/DevHive.Data/Models/Rating.cs17
-rw-r--r--src/DevHive.Data/Models/Role.cs17
-rw-r--r--src/DevHive.Data/Models/Technology.cs15
-rw-r--r--src/DevHive.Data/Models/User.cs33
-rw-r--r--src/DevHive.Data/RelationModels/PostAttachments.cs16
-rw-r--r--src/DevHive.Data/RelationModels/RatedPost.cs18
-rw-r--r--src/DevHive.Data/RelationModels/UserRate.cs18
-rw-r--r--src/DevHive.Data/Repositories/BaseRepository.cs59
-rw-r--r--src/DevHive.Data/Repositories/CommentRepository.cs74
-rw-r--r--src/DevHive.Data/Repositories/FeedRepository.cs77
-rw-r--r--src/DevHive.Data/Repositories/LanguageRepository.cs53
-rw-r--r--src/DevHive.Data/Repositories/PostRepository.cs105
-rw-r--r--src/DevHive.Data/Repositories/RatingRepository.cs35
-rw-r--r--src/DevHive.Data/Repositories/RoleRepository.cs55
-rw-r--r--src/DevHive.Data/Repositories/TechnologyRepository.cs53
-rw-r--r--src/DevHive.Data/Repositories/UserRepository.cs108
51 files changed, 0 insertions, 5271 deletions
diff --git a/src/DevHive.Data/ConnectionString.json b/src/DevHive.Data/ConnectionString.json
deleted file mode 100644
index c8300b2..0000000
--- a/src/DevHive.Data/ConnectionString.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "ConnectionStrings": {
- "DEV": "Server=localhost;Port=5432;Database=API;User Id=postgres;Password=password;"
- }
-} \ No newline at end of file
diff --git a/src/DevHive.Data/DevHive.Data.csproj b/src/DevHive.Data/DevHive.Data.csproj
deleted file mode 100644
index d91728d..0000000
--- a/src/DevHive.Data/DevHive.Data.csproj
+++ /dev/null
@@ -1,30 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <TargetFramework>net5.0</TargetFramework>
- </PropertyGroup>
-
- <ItemGroup>
- <PackageReference Include="AutoMapper" Version="10.1.1" />
- <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.0" />
-
- <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.1" />
-
- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.1">
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
- <PrivateAssets>all</PrivateAssets>
- </PackageReference>
-
- <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
- </ItemGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\DevHive.Common\DevHive.Common.csproj" />
- </ItemGroup>
-
- <PropertyGroup>
- <EnableNETAnalyzers>true</EnableNETAnalyzers>
- <AnalysisLevel>latest</AnalysisLevel>
- </PropertyGroup>
-
-</Project>
diff --git a/src/DevHive.Data/DevHiveContext.cs b/src/DevHive.Data/DevHiveContext.cs
deleted file mode 100644
index 9de33c3..0000000
--- a/src/DevHive.Data/DevHiveContext.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-using System;
-using DevHive.Data.Models;
-using DevHive.Data.RelationModels;
-using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data
-{
- public class DevHiveContext : IdentityDbContext<User, Role, Guid>
- {
- public DevHiveContext(DbContextOptions<DevHiveContext> options)
- : base(options) { }
-
- public DbSet<Technology> Technologies { get; set; }
- public DbSet<Language> Languages { get; set; }
- public DbSet<Post> Posts { get; set; }
- public DbSet<PostAttachments> PostAttachments { get; set; }
- public DbSet<Comment> Comments { get; set; }
- public DbSet<Rating> Rating { get; set; }
- public DbSet<RatedPost> RatedPost { get; set; }
- public DbSet<UserRate> UserRate { get; set; }
-
- protected override void OnModelCreating(ModelBuilder builder)
- {
- /* User */
- builder.Entity<User>()
- .HasIndex(x => x.UserName)
- .IsUnique();
-
- builder.Entity<User>()
- .HasOne(x => x.ProfilePicture)
- .WithOne(x => x.User)
- .HasForeignKey<ProfilePicture>(x => x.UserId);
-
- /* Roles */
- builder.Entity<User>()
- .HasMany(x => x.Roles)
- .WithMany(x => x.Users);
-
- /* Languages */
- builder.Entity<User>()
- .HasMany(x => x.Languages)
- .WithMany(x => x.Users)
- .UsingEntity(x => x.ToTable("LanguageUser"));
-
- builder.Entity<Language>()
- .HasMany(x => x.Users)
- .WithMany(x => x.Languages)
- .UsingEntity(x => x.ToTable("LanguageUser"));
-
- /* Technologies */
- builder.Entity<User>()
- .HasMany(x => x.Technologies)
- .WithMany(x => x.Users)
- .UsingEntity(x => x.ToTable("TechnologyUser"));
-
- builder.Entity<Technology>()
- .HasMany(x => x.Users)
- .WithMany(x => x.Technologies)
- .UsingEntity(x => x.ToTable("TechnologyUser"));
-
- /* Post */
- builder.Entity<Post>()
- .HasOne(x => x.Creator)
- .WithMany(x => x.Posts);
-
- builder.Entity<Post>()
- .HasMany(x => x.Comments)
- .WithOne(x => x.Post);
-
- /* Post attachments */
- builder.Entity<PostAttachments>()
- .HasOne(x => x.Post)
- .WithMany(x => x.Attachments);
-
- /* Comment */
- builder.Entity<Comment>()
- .HasOne(x => x.Post)
- .WithMany(x => x.Comments);
-
- builder.Entity<Comment>()
- .HasOne(x => x.Creator)
- .WithMany(x => x.Comments);
-
- /* Rating */
- builder.Entity<Rating>()
- .HasKey(x => x.Id);
-
- builder.Entity<Rating>()
- .HasOne(x => x.Post)
- .WithOne(x => x.Rating)
- .HasForeignKey<Rating>(x => x.PostId);
-
- builder.Entity<Post>()
- .HasOne(x => x.Rating)
- .WithOne(x => x.Post);
-
- /* User Rated Posts */
- builder.Entity<RatedPost>()
- .HasKey(x => new { x.UserId, x.PostId });
-
- builder.Entity<RatedPost>()
- .HasOne(x => x.User)
- .WithMany(x => x.RatedPosts);
-
- builder.Entity<RatedPost>()
- .HasOne(x => x.Post);
-
- builder.Entity<User>()
- .HasMany(x => x.RatedPosts);
-
- base.OnModelCreating(builder);
- }
- }
-}
diff --git a/src/DevHive.Data/DevHiveContextFactory.cs b/src/DevHive.Data/DevHiveContextFactory.cs
deleted file mode 100644
index f4849d7..0000000
--- a/src/DevHive.Data/DevHiveContextFactory.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Design;
-using Microsoft.Extensions.Configuration;
-using System.IO;
-
-namespace DevHive.Data
-{
- public class DevHiveContextFactory : IDesignTimeDbContextFactory<DevHiveContext>
- {
- public DevHiveContext CreateDbContext(string[] args)
- {
- var configuration = new ConfigurationBuilder()
- .SetBasePath(Directory.GetCurrentDirectory())
- .AddJsonFile("ConnectionString.json")
- .Build();
-
- var optionsBuilder = new DbContextOptionsBuilder<DevHiveContext>()
- .UseNpgsql(configuration.GetConnectionString("DEV"));
-
- return new DevHiveContext(optionsBuilder.Options);
- }
- }
-} \ No newline at end of file
diff --git a/src/DevHive.Data/Interfaces/Models/IComment.cs b/src/DevHive.Data/Interfaces/Models/IComment.cs
deleted file mode 100644
index 97c1578..0000000
--- a/src/DevHive.Data/Interfaces/Models/IComment.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using DevHive.Data.Models;
-
-namespace DevHive.Data.Interfaces.Models
-{
- public interface IComment : IModel
- {
- Post Post { get; set; }
-
- User Creator { get; set; }
-
- string Message { get; set; }
-
- DateTime TimeCreated { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Models/ILanguage.cs b/src/DevHive.Data/Interfaces/Models/ILanguage.cs
deleted file mode 100644
index 9eed09d..0000000
--- a/src/DevHive.Data/Interfaces/Models/ILanguage.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Collections.Generic;
-using DevHive.Data.Models;
-
-namespace DevHive.Data.Interfaces.Models
-{
- public interface ILanguage : IModel
- {
- string Name { get; set; }
- HashSet<User> Users { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Models/IModel.cs b/src/DevHive.Data/Interfaces/Models/IModel.cs
deleted file mode 100644
index f903af3..0000000
--- a/src/DevHive.Data/Interfaces/Models/IModel.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System;
-
-namespace DevHive.Data.Interfaces.Models
-{
- public interface IModel
- {
- Guid Id { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Models/IPost.cs b/src/DevHive.Data/Interfaces/Models/IPost.cs
deleted file mode 100644
index 712d955..0000000
--- a/src/DevHive.Data/Interfaces/Models/IPost.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using DevHive.Data.Models;
-using DevHive.Data.RelationModels;
-
-namespace DevHive.Data.Interfaces.Models
-{
- public interface IPost : IModel
- {
- User Creator { get; set; }
-
- string Message { get; set; }
-
- DateTime TimeCreated { get; set; }
-
- List<Comment> Comments { get; set; }
-
- // Rating Rating { get; set; }
-
- List<PostAttachments> Attachments { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Models/IProfilePicture.cs b/src/DevHive.Data/Interfaces/Models/IProfilePicture.cs
deleted file mode 100644
index c3fcbea..0000000
--- a/src/DevHive.Data/Interfaces/Models/IProfilePicture.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using DevHive.Data.Models;
-
-namespace DevHive.Data.Interfaces.Models
-{
- public interface IProfilePicture : IModel
- {
- Guid UserId { get; set; }
- User User { get; set; }
-
- string PictureURL { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Models/IRating.cs b/src/DevHive.Data/Interfaces/Models/IRating.cs
deleted file mode 100644
index d1b968f..0000000
--- a/src/DevHive.Data/Interfaces/Models/IRating.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Collections.Generic;
-using DevHive.Data.Models;
-
-namespace DevHive.Data.Interfaces.Models
-{
- public interface IRating : IModel
- {
- // Post Post { get; set; }
-
- int Rate { get; set; }
-
- // HashSet<User> UsersThatRated { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Models/IRole.cs b/src/DevHive.Data/Interfaces/Models/IRole.cs
deleted file mode 100644
index c8b7068..0000000
--- a/src/DevHive.Data/Interfaces/Models/IRole.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Collections.Generic;
-using DevHive.Data.Models;
-
-namespace DevHive.Data.Interfaces.Models
-{
- public interface IRole
- {
- HashSet<User> Users { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Models/ITechnology.cs b/src/DevHive.Data/Interfaces/Models/ITechnology.cs
deleted file mode 100644
index 153f75f..0000000
--- a/src/DevHive.Data/Interfaces/Models/ITechnology.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Collections.Generic;
-using DevHive.Data.Models;
-
-namespace DevHive.Data.Interfaces.Models
-{
- public interface ITechnology : IModel
- {
- string Name { get; set; }
- HashSet<User> Users { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Models/IUser.cs b/src/DevHive.Data/Interfaces/Models/IUser.cs
deleted file mode 100644
index fcd741c..0000000
--- a/src/DevHive.Data/Interfaces/Models/IUser.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Collections.Generic;
-using DevHive.Data.Models;
-using DevHive.Data.RelationModels;
-
-namespace DevHive.Data.Interfaces.Models
-{
- public interface IUser : IModel
- {
- string FirstName { get; set; }
-
- string LastName { get; set; }
-
- ProfilePicture ProfilePicture { get; set; }
-
- HashSet<Language> Languages { get; set; }
-
- HashSet<Technology> Technologies { get; set; }
-
- HashSet<Role> Roles { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs b/src/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs
deleted file mode 100644
index 267f251..0000000
--- a/src/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using DevHive.Data.Models;
-using DevHive.Data.Repositories.Interfaces;
-
-namespace DevHive.Data.Interfaces.Repositories
-{
- public interface ICommentRepository : IRepository<Comment>
- {
- Task<List<Comment>> GetPostComments(Guid postId);
-
- Task<bool> DoesCommentExist(Guid id);
- Task<Comment> GetCommentByIssuerAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated);
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs
deleted file mode 100644
index 7262510..0000000
--- a/src/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using DevHive.Data.Models;
-
-namespace DevHive.Data.Interfaces.Repositories
-{
- public interface IFeedRepository
- {
- Task<List<Post>> GetFriendsPosts(List<User> friendsList, DateTime firstRequestIssued, int pageNumber, int pageSize);
- Task<List<Post>> GetUsersPosts(User user, DateTime firstRequestIssued, int pageNumber, int pageSize);
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs b/src/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs
deleted file mode 100644
index db2949a..0000000
--- a/src/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using DevHive.Data.Models;
-using DevHive.Data.Repositories.Interfaces;
-
-namespace DevHive.Data.Interfaces.Repositories
-{
- public interface ILanguageRepository : IRepository<Language>
- {
- HashSet<Language> GetLanguages();
- Task<Language> GetByNameAsync(string name);
-
- Task<bool> DoesLanguageExistAsync(Guid id);
- Task<bool> DoesLanguageNameExistAsync(string languageName);
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Repositories/IPostRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IPostRepository.cs
deleted file mode 100644
index 9f7cf85..0000000
--- a/src/DevHive.Data/Interfaces/Repositories/IPostRepository.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using DevHive.Data.Models;
-using DevHive.Data.Repositories.Interfaces;
-
-namespace DevHive.Data.Interfaces.Repositories
-{
- public interface IPostRepository : IRepository<Post>
- {
- Task<bool> AddNewPostToCreator(Guid userId, Post post);
-
- Task<Post> GetPostByCreatorAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated);
- Task<List<string>> GetFileUrls(Guid postId);
-
- Task<bool> DoesPostExist(Guid postId);
- Task<bool> DoesPostHaveFiles(Guid postId);
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs
deleted file mode 100644
index f77f301..0000000
--- a/src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using DevHive.Data.Models;
-using DevHive.Data.Repositories.Interfaces;
-
-namespace DevHive.Data.Interfaces.Repositories
-{
- public interface IRatingRepository : IRepository<Rating>
- {
- Task<Rating> GetRatingByPostId(Guid postId);
- Task<bool> UserRatedPost(Guid userId, Guid postId);
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Repositories/IRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IRepository.cs
deleted file mode 100644
index 0d11cd3..0000000
--- a/src/DevHive.Data/Interfaces/Repositories/IRepository.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Threading.Tasks;
-
-namespace DevHive.Data.Repositories.Interfaces
-{
- public interface IRepository<TEntity>
- where TEntity : class
- {
- //Add Entity to database
- Task<bool> AddAsync(TEntity entity);
-
- //Find entity by id
- Task<TEntity> GetByIdAsync(Guid id);
-
- //Modify Entity from database
- Task<bool> EditAsync(Guid id, TEntity newEntity);
-
- //Delete Entity from database
- Task<bool> DeleteAsync(TEntity entity);
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Repositories/IRoleRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IRoleRepository.cs
deleted file mode 100644
index e834369..0000000
--- a/src/DevHive.Data/Interfaces/Repositories/IRoleRepository.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using DevHive.Data.Models;
-using DevHive.Data.Repositories.Interfaces;
-
-namespace DevHive.Data.Interfaces.Repositories
-{
- public interface IRoleRepository : IRepository<Role>
- {
- Task<Role> GetByNameAsync(string name);
-
- Task<bool> DoesNameExist(string name);
- Task<bool> DoesRoleExist(Guid id);
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs b/src/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs
deleted file mode 100644
index 9126bfc..0000000
--- a/src/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using DevHive.Data.Models;
-using DevHive.Data.Repositories.Interfaces;
-
-namespace DevHive.Data.Interfaces.Repositories
-{
- public interface ITechnologyRepository : IRepository<Technology>
- {
- Task<Technology> GetByNameAsync(string name);
- HashSet<Technology> GetTechnologies();
-
- Task<bool> DoesTechnologyExistAsync(Guid id);
- Task<bool> DoesTechnologyNameExistAsync(string technologyName);
- }
-}
diff --git a/src/DevHive.Data/Interfaces/Repositories/IUserRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IUserRepository.cs
deleted file mode 100644
index 5ebe3d3..0000000
--- a/src/DevHive.Data/Interfaces/Repositories/IUserRepository.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using DevHive.Data.Models;
-using DevHive.Data.Repositories.Interfaces;
-
-namespace DevHive.Data.Interfaces.Repositories
-{
- public interface IUserRepository : IRepository<User>
- {
- //Read
- Task<User> GetByUsernameAsync(string username);
- Task<bool> UpdateProfilePicture(Guid userId, string pictureUrl);
-
- //Validations
- Task<bool> ValidateFriendsCollectionAsync(List<string> usernames);
- Task<bool> DoesEmailExistAsync(string email);
- Task<bool> DoesUserExistAsync(Guid id);
- Task<bool> DoesUsernameExistAsync(string username);
- bool DoesUserHaveThisUsername(Guid id, string username);
- }
-}
diff --git a/src/DevHive.Data/Migrations/20210205140955_rating.Designer.cs b/src/DevHive.Data/Migrations/20210205140955_rating.Designer.cs
deleted file mode 100644
index 8d2adc4..0000000
--- a/src/DevHive.Data/Migrations/20210205140955_rating.Designer.cs
+++ /dev/null
@@ -1,665 +0,0 @@
-// <auto-generated />
-using System;
-using System.Collections.Generic;
-using DevHive.Data;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-namespace DevHive.Data.Migrations
-{
- [DbContext(typeof(DevHiveContext))]
- [Migration("20210205140955_rating")]
- partial class rating
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .UseIdentityByDefaultColumns()
- .HasAnnotation("Relational:MaxIdentifierLength", 63)
- .HasAnnotation("ProductVersion", "5.0.1");
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.HasIndex("PostId");
-
- b.ToTable("Comments");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Language", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Languages");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<List<string>>("FileUrls")
- .HasColumnType("text[]");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.ToTable("Posts");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("PictureURL")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique();
-
- b.ToTable("ProfilePicture");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Rating", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid>("PostId")
- .HasColumnType("uuid");
-
- b.Property<int>("Rate")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("PostId")
- .IsUnique();
-
- b.ToTable("Rating");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Role", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedName")
- .IsUnique()
- .HasDatabaseName("RoleNameIndex");
-
- b.ToTable("AspNetRoles");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Technology", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Technologies");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("FirstName")
- .HasColumnType("text");
-
- b.Property<string>("LastName")
- .HasColumnType("text");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedUserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedEmail")
- .HasDatabaseName("EmailIndex");
-
- b.HasIndex("NormalizedUserName")
- .IsUnique()
- .HasDatabaseName("UserNameIndex");
-
- b.HasIndex("UserName")
- .IsUnique();
-
- b.ToTable("AspNetUsers");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("PostId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "PostId");
-
- b.HasIndex("PostId");
-
- b.ToTable("RatedPosts");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserFriend", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("FriendId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "FriendId");
-
- b.HasIndex("FriendId");
-
- b.ToTable("UserFriends");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<bool>("Liked")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.Property<Guid?>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("PostId");
-
- b.HasIndex("UserId");
-
- b.ToTable("UserRates");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.Property<Guid>("LanguagesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("LanguagesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("LanguageUser");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetRoleClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserLogins");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "RoleId");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetUserRoles");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("AspNetUserTokens");
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.Property<Guid>("RolesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("RolesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("RoleUser");
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.Property<Guid>("TechnologiesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("TechnologiesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("TechnologyUser");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Comments")
- .HasForeignKey("CreatorId");
-
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany("Comments")
- .HasForeignKey("PostId");
-
- b.Navigation("Creator");
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Posts")
- .HasForeignKey("CreatorId");
-
- b.Navigation("Creator");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithOne("ProfilePicture")
- .HasForeignKey("DevHive.Data.Models.ProfilePicture", "UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Rating", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithOne("Rating")
- .HasForeignKey("DevHive.Data.Models.Rating", "PostId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany()
- .HasForeignKey("PostId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany("RatedPosts")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Post");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserFriend", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Friend")
- .WithMany("FriendsOf")
- .HasForeignKey("FriendId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany("MyFriends")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Friend");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany()
- .HasForeignKey("PostId");
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany()
- .HasForeignKey("UserId");
-
- b.Navigation("Post");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Language", null)
- .WithMany()
- .HasForeignKey("LanguagesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RolesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Technology", null)
- .WithMany()
- .HasForeignKey("TechnologiesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Navigation("Comments");
-
- b.Navigation("Rating");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Navigation("Comments");
-
- b.Navigation("FriendsOf");
-
- b.Navigation("MyFriends");
-
- b.Navigation("Posts");
-
- b.Navigation("ProfilePicture");
-
- b.Navigation("RatedPosts");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/DevHive.Data/Migrations/20210205140955_rating.cs b/src/DevHive.Data/Migrations/20210205140955_rating.cs
deleted file mode 100644
index d507dae..0000000
--- a/src/DevHive.Data/Migrations/20210205140955_rating.cs
+++ /dev/null
@@ -1,581 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-namespace DevHive.Data.Migrations
-{
- public partial class rating : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "AspNetRoles",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoles", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUsers",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- FirstName = table.Column<string>(type: "text", nullable: true),
- LastName = table.Column<string>(type: "text", nullable: true),
- UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
- EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
- PasswordHash = table.Column<string>(type: "text", nullable: true),
- SecurityStamp = table.Column<string>(type: "text", nullable: true),
- ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
- PhoneNumber = table.Column<string>(type: "text", nullable: true),
- PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
- TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
- LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
- LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
- AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUsers", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Languages",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- Name = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Languages", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Technologies",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- Name = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Technologies", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetRoleClaims",
- columns: table => new
- {
- Id = table.Column<int>(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- RoleId = table.Column<Guid>(type: "uuid", nullable: false),
- ClaimType = table.Column<string>(type: "text", nullable: true),
- ClaimValue = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserClaims",
- columns: table => new
- {
- Id = table.Column<int>(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- UserId = table.Column<Guid>(type: "uuid", nullable: false),
- ClaimType = table.Column<string>(type: "text", nullable: true),
- ClaimValue = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetUserClaims_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserLogins",
- columns: table => new
- {
- LoginProvider = table.Column<string>(type: "text", nullable: false),
- ProviderKey = table.Column<string>(type: "text", nullable: false),
- ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
- UserId = table.Column<Guid>(type: "uuid", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
- table.ForeignKey(
- name: "FK_AspNetUserLogins_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserRoles",
- columns: table => new
- {
- UserId = table.Column<Guid>(type: "uuid", nullable: false),
- RoleId = table.Column<Guid>(type: "uuid", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
- table.ForeignKey(
- name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_AspNetUserRoles_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserTokens",
- columns: table => new
- {
- UserId = table.Column<Guid>(type: "uuid", nullable: false),
- LoginProvider = table.Column<string>(type: "text", nullable: false),
- Name = table.Column<string>(type: "text", nullable: false),
- Value = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
- table.ForeignKey(
- name: "FK_AspNetUserTokens_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "Posts",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- CreatorId = table.Column<Guid>(type: "uuid", nullable: true),
- Message = table.Column<string>(type: "text", nullable: true),
- TimeCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
- FileUrls = table.Column<List<string>>(type: "text[]", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Posts", x => x.Id);
- table.ForeignKey(
- name: "FK_Posts_AspNetUsers_CreatorId",
- column: x => x.CreatorId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "ProfilePicture",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- UserId = table.Column<Guid>(type: "uuid", nullable: false),
- PictureURL = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ProfilePicture", x => x.Id);
- table.ForeignKey(
- name: "FK_ProfilePicture_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "RoleUser",
- columns: table => new
- {
- RolesId = table.Column<Guid>(type: "uuid", nullable: false),
- UsersId = table.Column<Guid>(type: "uuid", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_RoleUser", x => new { x.RolesId, x.UsersId });
- table.ForeignKey(
- name: "FK_RoleUser_AspNetRoles_RolesId",
- column: x => x.RolesId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_RoleUser_AspNetUsers_UsersId",
- column: x => x.UsersId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "UserFriends",
- columns: table => new
- {
- UserId = table.Column<Guid>(type: "uuid", nullable: false),
- FriendId = table.Column<Guid>(type: "uuid", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserFriends", x => new { x.UserId, x.FriendId });
- table.ForeignKey(
- name: "FK_UserFriends_AspNetUsers_FriendId",
- column: x => x.FriendId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_UserFriends_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "LanguageUser",
- columns: table => new
- {
- LanguagesId = table.Column<Guid>(type: "uuid", nullable: false),
- UsersId = table.Column<Guid>(type: "uuid", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_LanguageUser", x => new { x.LanguagesId, x.UsersId });
- table.ForeignKey(
- name: "FK_LanguageUser_AspNetUsers_UsersId",
- column: x => x.UsersId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_LanguageUser_Languages_LanguagesId",
- column: x => x.LanguagesId,
- principalTable: "Languages",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "TechnologyUser",
- columns: table => new
- {
- TechnologiesId = table.Column<Guid>(type: "uuid", nullable: false),
- UsersId = table.Column<Guid>(type: "uuid", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_TechnologyUser", x => new { x.TechnologiesId, x.UsersId });
- table.ForeignKey(
- name: "FK_TechnologyUser_AspNetUsers_UsersId",
- column: x => x.UsersId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_TechnologyUser_Technologies_TechnologiesId",
- column: x => x.TechnologiesId,
- principalTable: "Technologies",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "Comments",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- PostId = table.Column<Guid>(type: "uuid", nullable: true),
- CreatorId = table.Column<Guid>(type: "uuid", nullable: true),
- Message = table.Column<string>(type: "text", nullable: true),
- TimeCreated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Comments", x => x.Id);
- table.ForeignKey(
- name: "FK_Comments_AspNetUsers_CreatorId",
- column: x => x.CreatorId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- table.ForeignKey(
- name: "FK_Comments_Posts_PostId",
- column: x => x.PostId,
- principalTable: "Posts",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "RatedPosts",
- columns: table => new
- {
- UserId = table.Column<Guid>(type: "uuid", nullable: false),
- PostId = table.Column<Guid>(type: "uuid", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_RatedPosts", x => new { x.UserId, x.PostId });
- table.ForeignKey(
- name: "FK_RatedPosts_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_RatedPosts_Posts_PostId",
- column: x => x.PostId,
- principalTable: "Posts",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "Rating",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- PostId = table.Column<Guid>(type: "uuid", nullable: false),
- Rate = table.Column<int>(type: "integer", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Rating", x => x.Id);
- table.ForeignKey(
- name: "FK_Rating_Posts_PostId",
- column: x => x.PostId,
- principalTable: "Posts",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "UserRates",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- UserId = table.Column<Guid>(type: "uuid", nullable: true),
- Liked = table.Column<bool>(type: "boolean", nullable: false),
- PostId = table.Column<Guid>(type: "uuid", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserRates", x => x.Id);
- table.ForeignKey(
- name: "FK_UserRates_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- table.ForeignKey(
- name: "FK_UserRates_Posts_PostId",
- column: x => x.PostId,
- principalTable: "Posts",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetRoleClaims_RoleId",
- table: "AspNetRoleClaims",
- column: "RoleId");
-
- migrationBuilder.CreateIndex(
- name: "RoleNameIndex",
- table: "AspNetRoles",
- column: "NormalizedName",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserClaims_UserId",
- table: "AspNetUserClaims",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserLogins_UserId",
- table: "AspNetUserLogins",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserRoles_RoleId",
- table: "AspNetUserRoles",
- column: "RoleId");
-
- migrationBuilder.CreateIndex(
- name: "EmailIndex",
- table: "AspNetUsers",
- column: "NormalizedEmail");
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUsers_UserName",
- table: "AspNetUsers",
- column: "UserName",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "UserNameIndex",
- table: "AspNetUsers",
- column: "NormalizedUserName",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_Comments_CreatorId",
- table: "Comments",
- column: "CreatorId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Comments_PostId",
- table: "Comments",
- column: "PostId");
-
- migrationBuilder.CreateIndex(
- name: "IX_LanguageUser_UsersId",
- table: "LanguageUser",
- column: "UsersId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Posts_CreatorId",
- table: "Posts",
- column: "CreatorId");
-
- migrationBuilder.CreateIndex(
- name: "IX_ProfilePicture_UserId",
- table: "ProfilePicture",
- column: "UserId",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_RatedPosts_PostId",
- table: "RatedPosts",
- column: "PostId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Rating_PostId",
- table: "Rating",
- column: "PostId",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_RoleUser_UsersId",
- table: "RoleUser",
- column: "UsersId");
-
- migrationBuilder.CreateIndex(
- name: "IX_TechnologyUser_UsersId",
- table: "TechnologyUser",
- column: "UsersId");
-
- migrationBuilder.CreateIndex(
- name: "IX_UserFriends_FriendId",
- table: "UserFriends",
- column: "FriendId");
-
- migrationBuilder.CreateIndex(
- name: "IX_UserRates_PostId",
- table: "UserRates",
- column: "PostId");
-
- migrationBuilder.CreateIndex(
- name: "IX_UserRates_UserId",
- table: "UserRates",
- column: "UserId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "AspNetRoleClaims");
-
- migrationBuilder.DropTable(
- name: "AspNetUserClaims");
-
- migrationBuilder.DropTable(
- name: "AspNetUserLogins");
-
- migrationBuilder.DropTable(
- name: "AspNetUserRoles");
-
- migrationBuilder.DropTable(
- name: "AspNetUserTokens");
-
- migrationBuilder.DropTable(
- name: "Comments");
-
- migrationBuilder.DropTable(
- name: "LanguageUser");
-
- migrationBuilder.DropTable(
- name: "ProfilePicture");
-
- migrationBuilder.DropTable(
- name: "RatedPosts");
-
- migrationBuilder.DropTable(
- name: "Rating");
-
- migrationBuilder.DropTable(
- name: "RoleUser");
-
- migrationBuilder.DropTable(
- name: "TechnologyUser");
-
- migrationBuilder.DropTable(
- name: "UserFriends");
-
- migrationBuilder.DropTable(
- name: "UserRates");
-
- migrationBuilder.DropTable(
- name: "Languages");
-
- migrationBuilder.DropTable(
- name: "AspNetRoles");
-
- migrationBuilder.DropTable(
- name: "Technologies");
-
- migrationBuilder.DropTable(
- name: "Posts");
-
- migrationBuilder.DropTable(
- name: "AspNetUsers");
- }
- }
-}
diff --git a/src/DevHive.Data/Migrations/20210205150447_Friends_Init_Config.Designer.cs b/src/DevHive.Data/Migrations/20210205150447_Friends_Init_Config.Designer.cs
deleted file mode 100644
index c11374a..0000000
--- a/src/DevHive.Data/Migrations/20210205150447_Friends_Init_Config.Designer.cs
+++ /dev/null
@@ -1,643 +0,0 @@
-// <auto-generated />
-using System;
-using System.Collections.Generic;
-using DevHive.Data;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-namespace DevHive.Data.Migrations
-{
- [DbContext(typeof(DevHiveContext))]
- [Migration("20210205150447_Friends_Init_Config")]
- partial class Friends_Init_Config
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .UseIdentityByDefaultColumns()
- .HasAnnotation("Relational:MaxIdentifierLength", 63)
- .HasAnnotation("ProductVersion", "5.0.1");
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.HasIndex("PostId");
-
- b.ToTable("Comments");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Language", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Languages");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<List<string>>("FileUrls")
- .HasColumnType("text[]");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.ToTable("Posts");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("PictureURL")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique();
-
- b.ToTable("ProfilePicture");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Rating", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("Rate")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("Rating");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Role", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedName")
- .IsUnique()
- .HasDatabaseName("RoleNameIndex");
-
- b.ToTable("AspNetRoles");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Technology", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Technologies");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("FirstName")
- .HasColumnType("text");
-
- b.Property<string>("LastName")
- .HasColumnType("text");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedUserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("UserId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedEmail")
- .HasDatabaseName("EmailIndex");
-
- b.HasIndex("NormalizedUserName")
- .IsUnique()
- .HasDatabaseName("UserNameIndex");
-
- b.HasIndex("UserId");
-
- b.HasIndex("UserName")
- .IsUnique();
-
- b.ToTable("AspNetUsers");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("PostId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "PostId");
-
- b.HasIndex("PostId");
-
- b.ToTable("RatedPosts");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserFriend", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("FriendId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "FriendId");
-
- b.HasIndex("FriendId");
-
- b.ToTable("UserFriends");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<bool>("Rate")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("UserRates");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.Property<Guid>("LanguagesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("LanguagesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("LanguageUser");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetRoleClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserLogins");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "RoleId");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetUserRoles");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("AspNetUserTokens");
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.Property<Guid>("RolesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("RolesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("RoleUser");
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.Property<Guid>("TechnologiesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("TechnologiesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("TechnologyUser");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Comments")
- .HasForeignKey("CreatorId");
-
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany("Comments")
- .HasForeignKey("PostId");
-
- b.Navigation("Creator");
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Posts")
- .HasForeignKey("CreatorId");
-
- b.Navigation("Creator");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithOne("ProfilePicture")
- .HasForeignKey("DevHive.Data.Models.ProfilePicture", "UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany("Friends")
- .HasForeignKey("UserId");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany()
- .HasForeignKey("PostId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Post");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserFriend", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Friend")
- .WithMany()
- .HasForeignKey("FriendId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Friend");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany()
- .HasForeignKey("UserId");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Language", null)
- .WithMany()
- .HasForeignKey("LanguagesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RolesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Technology", null)
- .WithMany()
- .HasForeignKey("TechnologiesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Navigation("Comments");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Navigation("Comments");
-
- b.Navigation("Friends");
-
- b.Navigation("Posts");
-
- b.Navigation("ProfilePicture");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/DevHive.Data/Migrations/20210205150447_Friends_Init_Config.cs b/src/DevHive.Data/Migrations/20210205150447_Friends_Init_Config.cs
deleted file mode 100644
index 1fc970d..0000000
--- a/src/DevHive.Data/Migrations/20210205150447_Friends_Init_Config.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace DevHive.Data.Migrations
-{
- public partial class Friends_Init_Config : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<Guid>(
- name: "UserId",
- table: "AspNetUsers",
- type: "uuid",
- nullable: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUsers_UserId",
- table: "AspNetUsers",
- column: "UserId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_AspNetUsers_AspNetUsers_UserId",
- table: "AspNetUsers",
- column: "UserId",
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_AspNetUsers_AspNetUsers_UserId",
- table: "AspNetUsers");
-
- migrationBuilder.DropIndex(
- name: "IX_AspNetUsers_UserId",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "UserId",
- table: "AspNetUsers");
- }
- }
-}
diff --git a/src/DevHive.Data/Migrations/20210205154810_PostFileAttachments.Designer.cs b/src/DevHive.Data/Migrations/20210205154810_PostFileAttachments.Designer.cs
deleted file mode 100644
index 5d8e13a..0000000
--- a/src/DevHive.Data/Migrations/20210205154810_PostFileAttachments.Designer.cs
+++ /dev/null
@@ -1,691 +0,0 @@
-// <auto-generated />
-using System;
-using DevHive.Data;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-namespace DevHive.Data.Migrations
-{
- [DbContext(typeof(DevHiveContext))]
- [Migration("20210205154810_PostFileAttachments")]
- partial class PostFileAttachments
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .UseIdentityByDefaultColumns()
- .HasAnnotation("Relational:MaxIdentifierLength", 63)
- .HasAnnotation("ProductVersion", "5.0.1");
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.HasIndex("PostId");
-
- b.ToTable("Comments");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Language", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Languages");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.ToTable("Posts");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("PictureURL")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique();
-
- b.ToTable("ProfilePicture");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Rating", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid>("PostId")
- .HasColumnType("uuid");
-
- b.Property<int>("Rate")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("PostId")
- .IsUnique();
-
- b.ToTable("Rating");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Role", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedName")
- .IsUnique()
- .HasDatabaseName("RoleNameIndex");
-
- b.ToTable("AspNetRoles");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Technology", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Technologies");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("FirstName")
- .HasColumnType("text");
-
- b.Property<string>("LastName")
- .HasColumnType("text");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedUserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedEmail")
- .HasDatabaseName("EmailIndex");
-
- b.HasIndex("NormalizedUserName")
- .IsUnique()
- .HasDatabaseName("UserNameIndex");
-
- b.HasIndex("UserName")
- .IsUnique();
-
- b.ToTable("AspNetUsers");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.PostAttachments", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("FileUrl")
- .HasColumnType("text");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("PostId");
-
- b.ToTable("PostAttachments");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("PostId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "PostId");
-
- b.HasIndex("PostId");
-
- b.ToTable("RatedPosts");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserFriend", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("FriendId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "FriendId");
-
- b.HasIndex("FriendId");
-
- b.ToTable("UserFriends");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<bool>("Liked")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.Property<Guid?>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("PostId");
-
- b.HasIndex("UserId");
-
- b.ToTable("UserRates");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.Property<Guid>("LanguagesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("LanguagesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("LanguageUser");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetRoleClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserLogins");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "RoleId");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetUserRoles");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("AspNetUserTokens");
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.Property<Guid>("RolesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("RolesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("RoleUser");
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.Property<Guid>("TechnologiesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("TechnologiesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("TechnologyUser");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Comments")
- .HasForeignKey("CreatorId");
-
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany("Comments")
- .HasForeignKey("PostId");
-
- b.Navigation("Creator");
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Posts")
- .HasForeignKey("CreatorId");
-
- b.Navigation("Creator");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithOne("ProfilePicture")
- .HasForeignKey("DevHive.Data.Models.ProfilePicture", "UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Rating", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithOne("Rating")
- .HasForeignKey("DevHive.Data.Models.Rating", "PostId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.PostAttachments", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany("Attachments")
- .HasForeignKey("PostId");
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany()
- .HasForeignKey("PostId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany("RatedPosts")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Post");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserFriend", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Friend")
- .WithMany("FriendsOf")
- .HasForeignKey("FriendId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany("MyFriends")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Friend");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany()
- .HasForeignKey("PostId");
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany()
- .HasForeignKey("UserId");
-
- b.Navigation("Post");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Language", null)
- .WithMany()
- .HasForeignKey("LanguagesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RolesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Technology", null)
- .WithMany()
- .HasForeignKey("TechnologiesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Navigation("Attachments");
-
- b.Navigation("Comments");
-
- b.Navigation("Rating");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Navigation("Comments");
-
- b.Navigation("FriendsOf");
-
- b.Navigation("MyFriends");
-
- b.Navigation("Posts");
-
- b.Navigation("ProfilePicture");
-
- b.Navigation("RatedPosts");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/DevHive.Data/Migrations/20210205154810_PostFileAttachments.cs b/src/DevHive.Data/Migrations/20210205154810_PostFileAttachments.cs
deleted file mode 100644
index 7b7b933..0000000
--- a/src/DevHive.Data/Migrations/20210205154810_PostFileAttachments.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace DevHive.Data.Migrations
-{
- public partial class PostFileAttachments : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "FileUrls",
- table: "Posts");
-
- migrationBuilder.CreateTable(
- name: "PostAttachments",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- PostId = table.Column<Guid>(type: "uuid", nullable: true),
- FileUrl = table.Column<string>(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_PostAttachments", x => x.Id);
- table.ForeignKey(
- name: "FK_PostAttachments_Posts_PostId",
- column: x => x.PostId,
- principalTable: "Posts",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_PostAttachments_PostId",
- table: "PostAttachments",
- column: "PostId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "PostAttachments");
-
- migrationBuilder.AddColumn<string[]>(
- name: "FileUrls",
- table: "Posts",
- type: "text[]",
- nullable: true);
- }
- }
-}
diff --git a/src/DevHive.Data/Migrations/20210205160520_Friends_First_Tweek.Designer.cs b/src/DevHive.Data/Migrations/20210205160520_Friends_First_Tweek.Designer.cs
deleted file mode 100644
index 3ad3ec8..0000000
--- a/src/DevHive.Data/Migrations/20210205160520_Friends_First_Tweek.Designer.cs
+++ /dev/null
@@ -1,609 +0,0 @@
-// <auto-generated />
-using System;
-using System.Collections.Generic;
-using DevHive.Data;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-namespace DevHive.Data.Migrations
-{
- [DbContext(typeof(DevHiveContext))]
- [Migration("20210205160520_Friends_First_Tweek")]
- partial class Friends_First_Tweek
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .UseIdentityByDefaultColumns()
- .HasAnnotation("Relational:MaxIdentifierLength", 63)
- .HasAnnotation("ProductVersion", "5.0.1");
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.HasIndex("PostId");
-
- b.ToTable("Comments");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Language", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Languages");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<List<string>>("FileUrls")
- .HasColumnType("text[]");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.ToTable("Posts");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("PictureURL")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique();
-
- b.ToTable("ProfilePicture");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Rating", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("Rate")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("Rating");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Role", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedName")
- .IsUnique()
- .HasDatabaseName("RoleNameIndex");
-
- b.ToTable("AspNetRoles");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Technology", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Technologies");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("FirstName")
- .HasColumnType("text");
-
- b.Property<string>("LastName")
- .HasColumnType("text");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedUserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("UserId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedEmail")
- .HasDatabaseName("EmailIndex");
-
- b.HasIndex("NormalizedUserName")
- .IsUnique()
- .HasDatabaseName("UserNameIndex");
-
- b.HasIndex("UserId");
-
- b.HasIndex("UserName")
- .IsUnique();
-
- b.ToTable("AspNetUsers");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("PostId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "PostId");
-
- b.HasIndex("PostId");
-
- b.ToTable("RatedPosts");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<bool>("Rate")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("UserRates");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.Property<Guid>("LanguagesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("LanguagesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("LanguageUser");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetRoleClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserLogins");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "RoleId");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetUserRoles");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("AspNetUserTokens");
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.Property<Guid>("RolesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("RolesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("RoleUser");
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.Property<Guid>("TechnologiesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("TechnologiesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("TechnologyUser");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Comments")
- .HasForeignKey("CreatorId");
-
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany("Comments")
- .HasForeignKey("PostId");
-
- b.Navigation("Creator");
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Posts")
- .HasForeignKey("CreatorId");
-
- b.Navigation("Creator");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithOne("ProfilePicture")
- .HasForeignKey("DevHive.Data.Models.ProfilePicture", "UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany("Friends")
- .HasForeignKey("UserId");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany()
- .HasForeignKey("PostId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Post");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany()
- .HasForeignKey("UserId");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Language", null)
- .WithMany()
- .HasForeignKey("LanguagesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RolesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Technology", null)
- .WithMany()
- .HasForeignKey("TechnologiesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Navigation("Comments");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Navigation("Comments");
-
- b.Navigation("Friends");
-
- b.Navigation("Posts");
-
- b.Navigation("ProfilePicture");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/DevHive.Data/Migrations/20210205160520_Friends_First_Tweek.cs b/src/DevHive.Data/Migrations/20210205160520_Friends_First_Tweek.cs
deleted file mode 100644
index 565f863..0000000
--- a/src/DevHive.Data/Migrations/20210205160520_Friends_First_Tweek.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace DevHive.Data.Migrations
-{
- public partial class Friends_First_Tweek : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "UserFriends");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "UserFriends",
- columns: table => new
- {
- UserId = table.Column<Guid>(type: "uuid", nullable: false),
- FriendId = table.Column<Guid>(type: "uuid", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserFriends", x => new { x.UserId, x.FriendId });
- table.ForeignKey(
- name: "FK_UserFriends_AspNetUsers_FriendId",
- column: x => x.FriendId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_UserFriends_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_UserFriends_FriendId",
- table: "UserFriends",
- column: "FriendId");
- }
- }
-}
diff --git a/src/DevHive.Data/Migrations/DevHiveContextModelSnapshot.cs b/src/DevHive.Data/Migrations/DevHiveContextModelSnapshot.cs
deleted file mode 100644
index dc5739c..0000000
--- a/src/DevHive.Data/Migrations/DevHiveContextModelSnapshot.cs
+++ /dev/null
@@ -1,658 +0,0 @@
-// <auto-generated />
-using System;
-using DevHive.Data;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-namespace DevHive.Data.Migrations
-{
- [DbContext(typeof(DevHiveContext))]
- partial class DevHiveContextModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .UseIdentityByDefaultColumns()
- .HasAnnotation("Relational:MaxIdentifierLength", 63)
- .HasAnnotation("ProductVersion", "5.0.1");
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.HasIndex("PostId");
-
- b.ToTable("Comments");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Language", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Languages");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid?>("CreatorId")
- .HasColumnType("uuid");
-
- b.Property<string>("Message")
- .HasColumnType("text");
-
- b.Property<DateTime>("TimeCreated")
- .HasColumnType("timestamp without time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("CreatorId");
-
- b.ToTable("Posts");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("PictureURL")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique();
-
- b.ToTable("ProfilePicture");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Rating", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<Guid>("PostId")
- .HasColumnType("uuid");
-
- b.Property<int>("Rate")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("PostId")
- .IsUnique();
-
- b.ToTable("Rating");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Role", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedName")
- .IsUnique()
- .HasDatabaseName("RoleNameIndex");
-
- b.ToTable("AspNetRoles");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Technology", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Technologies");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("FirstName")
- .HasColumnType("text");
-
- b.Property<string>("LastName")
- .HasColumnType("text");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("NormalizedUserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("UserId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedEmail")
- .HasDatabaseName("EmailIndex");
-
- b.HasIndex("NormalizedUserName")
- .IsUnique()
- .HasDatabaseName("UserNameIndex");
-
- b.HasIndex("UserId");
-
- b.HasIndex("UserName")
- .IsUnique();
-
- b.ToTable("AspNetUsers");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.PostAttachments", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("FileUrl")
- .HasColumnType("text");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("PostId");
-
- b.ToTable("PostAttachments");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("PostId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "PostId");
-
- b.HasIndex("PostId");
-
- b.ToTable("RatedPosts");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<bool>("Liked")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("PostId")
- .HasColumnType("uuid");
-
- b.Property<Guid?>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("PostId");
-
- b.HasIndex("UserId");
-
- b.ToTable("UserRates");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.Property<Guid>("LanguagesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("LanguagesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("LanguageUser");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetRoleClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .UseIdentityByDefaultColumn();
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserLogins");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("RoleId")
- .HasColumnType("uuid");
-
- b.HasKey("UserId", "RoleId");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetUserRoles");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.Property<Guid>("UserId")
- .HasColumnType("uuid");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("AspNetUserTokens");
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.Property<Guid>("RolesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("RolesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("RoleUser");
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.Property<Guid>("TechnologiesId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("UsersId")
- .HasColumnType("uuid");
-
- b.HasKey("TechnologiesId", "UsersId");
-
- b.HasIndex("UsersId");
-
- b.ToTable("TechnologyUser");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Comment", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Comments")
- .HasForeignKey("CreatorId");
-
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany("Comments")
- .HasForeignKey("PostId");
-
- b.Navigation("Creator");
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "Creator")
- .WithMany("Posts")
- .HasForeignKey("CreatorId");
-
- b.Navigation("Creator");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.ProfilePicture", b =>
- {
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithOne("ProfilePicture")
- .HasForeignKey("DevHive.Data.Models.ProfilePicture", "UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Rating", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithOne("Rating")
- .HasForeignKey("DevHive.Data.Models.Rating", "PostId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.PostAttachments", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany("Attachments")
- .HasForeignKey("PostId");
-
- b.Navigation("Post");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany()
- .HasForeignKey("PostId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany("RatedPosts")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Post");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b =>
- {
- b.HasOne("DevHive.Data.Models.Post", "Post")
- .WithMany()
- .HasForeignKey("PostId");
-
- b.HasOne("DevHive.Data.Models.User", "User")
- .WithMany()
- .HasForeignKey("UserId");
-
- b.Navigation("Post");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("LanguageUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Language", null)
- .WithMany()
- .HasForeignKey("LanguagesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
- {
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("RoleUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Role", null)
- .WithMany()
- .HasForeignKey("RolesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("TechnologyUser", b =>
- {
- b.HasOne("DevHive.Data.Models.Technology", null)
- .WithMany()
- .HasForeignKey("TechnologiesId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("DevHive.Data.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("DevHive.Data.Models.Post", b =>
- {
- b.Navigation("Attachments");
-
- b.Navigation("Comments");
-
- b.Navigation("Rating");
- });
-
- modelBuilder.Entity("DevHive.Data.Models.User", b =>
- {
- b.Navigation("Comments");
-
- b.Navigation("Friends");
-
- b.Navigation("Posts");
-
- b.Navigation("ProfilePicture");
-
- b.Navigation("RatedPosts");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/DevHive.Data/Models/Comment.cs b/src/DevHive.Data/Models/Comment.cs
deleted file mode 100644
index e2bb21d..0000000
--- a/src/DevHive.Data/Models/Comment.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using DevHive.Data.Interfaces.Models;
-
-namespace DevHive.Data.Models
-{
- public class Comment : IComment
- {
- public Guid Id { get; set; }
-
- // public Guid PostId { get; set; }
- public Post Post { get; set; }
-
- // public Guid CreatorId { get; set; }
- public User Creator { get; set; }
-
- public string Message { get; set; }
-
- public DateTime TimeCreated { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Models/Language.cs b/src/DevHive.Data/Models/Language.cs
deleted file mode 100644
index 7ad8ff2..0000000
--- a/src/DevHive.Data/Models/Language.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using DevHive.Data.Interfaces.Models;
-
-namespace DevHive.Data.Models
-{
- public class Language : ILanguage
- {
- public Guid Id { get; set; }
-
- public string Name { get; set; }
-
- public HashSet<User> Users { get; set; } = new();
- }
-}
diff --git a/src/DevHive.Data/Models/Post.cs b/src/DevHive.Data/Models/Post.cs
deleted file mode 100644
index 3f3d8c9..0000000
--- a/src/DevHive.Data/Models/Post.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
-using DevHive.Data.Interfaces.Models;
-using DevHive.Data.RelationModels;
-
-namespace DevHive.Data.Models
-{
- [Table("Posts")]
- public class Post : IPost
- {
- public Guid Id { get; set; }
-
- public User Creator { get; set; }
-
- public string Message { get; set; }
-
- public DateTime TimeCreated { get; set; }
-
- public List<Comment> Comments { get; set; } = new();
-
- public Rating Rating { get; set; } = new();
-
- public List<PostAttachments> Attachments { get; set; } = new();
- }
-}
diff --git a/src/DevHive.Data/Models/ProfilePicture.cs b/src/DevHive.Data/Models/ProfilePicture.cs
deleted file mode 100644
index d5cc397..0000000
--- a/src/DevHive.Data/Models/ProfilePicture.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using DevHive.Data.Interfaces.Models;
-
-namespace DevHive.Data.Models
-{
- public class ProfilePicture: IProfilePicture
- {
- public Guid Id { get; set; }
-
- public Guid UserId { get; set; }
- public User User { get; set; }
-
- public string PictureURL { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Models/Rating.cs b/src/DevHive.Data/Models/Rating.cs
deleted file mode 100644
index e1bedd2..0000000
--- a/src/DevHive.Data/Models/Rating.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using DevHive.Data.Interfaces.Models;
-
-namespace DevHive.Data.Models
-{
- public class Rating : IRating
- {
- public Guid Id { get; set; }
-
- public Guid PostId { get; set; }
-
- public Post Post { get; set; }
-
- public int Rate { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Models/Role.cs b/src/DevHive.Data/Models/Role.cs
deleted file mode 100644
index 259d867..0000000
--- a/src/DevHive.Data/Models/Role.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Collections.Generic;
-using DevHive.Data.Interfaces.Models;
-using Microsoft.AspNetCore.Identity;
-using System;
-
-namespace DevHive.Data.Models
-{
- [Table("Roles")]
- public class Role : IdentityRole<Guid>, IRole
- {
- public const string DefaultRole = "User";
- public const string AdminRole = "Admin";
-
- public HashSet<User> Users { get; set; } = new();
- }
-}
diff --git a/src/DevHive.Data/Models/Technology.cs b/src/DevHive.Data/Models/Technology.cs
deleted file mode 100644
index 6f98f0b..0000000
--- a/src/DevHive.Data/Models/Technology.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using DevHive.Data.Interfaces.Models;
-
-namespace DevHive.Data.Models
-{
- public class Technology : ITechnology
- {
- public Guid Id { get; set; }
-
- public string Name { get; set; }
-
- public HashSet<User> Users { get; set; } = new();
- }
-}
diff --git a/src/DevHive.Data/Models/User.cs b/src/DevHive.Data/Models/User.cs
deleted file mode 100644
index 983d073..0000000
--- a/src/DevHive.Data/Models/User.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
-using DevHive.Data.Interfaces.Models;
-using DevHive.Data.RelationModels;
-using Microsoft.AspNetCore.Identity;
-
-namespace DevHive.Data.Models
-{
- [Table("Users")]
- public class User : IdentityUser<Guid>, IUser
- {
- public string FirstName { get; set; }
-
- public string LastName { get; set; }
-
- public ProfilePicture ProfilePicture { get; set; }
-
- public HashSet<Language> Languages { get; set; } = new();
-
- public HashSet<Technology> Technologies { get; set; } = new();
-
- public HashSet<Role> Roles { get; set; } = new();
-
- public HashSet<Post> Posts { get; set; } = new();
-
- public HashSet<User> Friends { get; set; } = new();
-
- public HashSet<Comment> Comments { get; set; } = new();
-
- public HashSet<RatedPost> RatedPosts { get; set; } = new();
- }
-}
diff --git a/src/DevHive.Data/RelationModels/PostAttachments.cs b/src/DevHive.Data/RelationModels/PostAttachments.cs
deleted file mode 100644
index 48aa8ff..0000000
--- a/src/DevHive.Data/RelationModels/PostAttachments.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
-using DevHive.Data.Models;
-
-namespace DevHive.Data.RelationModels
-{
- [Table("PostAttachments")]
- public class PostAttachments
- {
- public Guid Id { get; set; }
-
- public Post Post { get; set; }
-
- public string FileUrl { get; set; }
- }
-}
diff --git a/src/DevHive.Data/RelationModels/RatedPost.cs b/src/DevHive.Data/RelationModels/RatedPost.cs
deleted file mode 100644
index 7001d92..0000000
--- a/src/DevHive.Data/RelationModels/RatedPost.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Reflection.Metadata.Ecma335;
-using DevHive.Data.Models;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.RelationModels
-{
- [Table("RatedPosts")]
- public class RatedPost
- {
- public Guid UserId { get; set; }
- public User User { get; set; }
-
- public Guid PostId { get; set; }
- public Post Post { get; set; }
- }
-}
diff --git a/src/DevHive.Data/RelationModels/UserRate.cs b/src/DevHive.Data/RelationModels/UserRate.cs
deleted file mode 100644
index 696e6f3..0000000
--- a/src/DevHive.Data/RelationModels/UserRate.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
-using DevHive.Data.Models;
-
-namespace DevHive.Data.RelationModels
-{
- [Table("UserRates")]
- public class UserRate
- {
- public Guid Id { get; set; }
-
- public User User { get; set; }
-
- public bool Liked { get; set; }
-
- public Post Post { get; set; }
- }
-}
diff --git a/src/DevHive.Data/Repositories/BaseRepository.cs b/src/DevHive.Data/Repositories/BaseRepository.cs
deleted file mode 100644
index ece372e..0000000
--- a/src/DevHive.Data/Repositories/BaseRepository.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using DevHive.Data.Repositories.Interfaces;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.Repositories
-{
- public class BaseRepository<TEntity> : IRepository<TEntity>
- where TEntity : class
- {
- private readonly DbContext _context;
-
- public BaseRepository(DbContext context)
- {
- this._context = context;
- }
-
- public virtual async Task<bool> AddAsync(TEntity entity)
- {
- await this._context
- .Set<TEntity>()
- .AddAsync(entity);
-
- return await this.SaveChangesAsync();
- }
-
- public virtual async Task<TEntity> GetByIdAsync(Guid id)
- {
- return await this._context
- .Set<TEntity>()
- .FindAsync(id);
- }
-
- public virtual async Task<bool> EditAsync(Guid id, TEntity newEntity)
- {
- var entry = this._context.Entry(newEntity);
- if (entry.State == EntityState.Detached)
- this._context.Attach(newEntity);
-
- entry.State = EntityState.Modified;
-
- return await this.SaveChangesAsync();
- }
-
- public virtual async Task<bool> DeleteAsync(TEntity entity)
- {
- this._context.Remove(entity);
-
- return await this.SaveChangesAsync();
- }
-
- public virtual async Task<bool> SaveChangesAsync()
- {
- int result = await _context.SaveChangesAsync();
-
- return result >= 1;
- }
- }
-}
diff --git a/src/DevHive.Data/Repositories/CommentRepository.cs b/src/DevHive.Data/Repositories/CommentRepository.cs
deleted file mode 100644
index bee7624..0000000
--- a/src/DevHive.Data/Repositories/CommentRepository.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Threading.Tasks;
-using DevHive.Data.Interfaces.Repositories;
-using DevHive.Data.Models;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.Repositories
-{
- public class CommentRepository : BaseRepository<Comment>, ICommentRepository
- {
- private readonly DevHiveContext _context;
-
- public CommentRepository(DevHiveContext context)
- : base(context)
- {
- this._context = context;
- }
-
- #region Read
- public override async Task<Comment> GetByIdAsync(Guid id)
- {
- return await this._context.Comments
- .Include(x => x.Creator)
- .Include(x => x.Post)
- .FirstOrDefaultAsync(x => x.Id == id);
- }
-
- /// <summary>
- /// This method returns the comment that is made at exactly the given time and by the given creator
- /// </summary>
- public async Task<Comment> GetCommentByIssuerAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated)
- {
- return await this._context.Comments
- .FirstOrDefaultAsync(p => p.Creator.Id == issuerId &&
- p.TimeCreated == timeCreated);
- }
-
- public async Task<List<Comment>> GetPostComments(Guid postId)
- {
- return await this._context.Posts
- .SelectMany(x => x.Comments)
- .Where(x => x.Post.Id == postId)
- .ToListAsync();
- }
- #endregion
-
- #region Update
- public override async Task<bool> EditAsync(Guid id, Comment newEntity)
- {
- Comment comment = await this.GetByIdAsync(id);
-
- this._context
- .Entry(comment)
- .CurrentValues
- .SetValues(newEntity);
-
- return await this.SaveChangesAsync();
- }
- #endregion
-
-
- #region Validations
- public async Task<bool> DoesCommentExist(Guid id)
- {
- return await this._context.Comments
- .AsNoTracking()
- .AnyAsync(r => r.Id == id);
- }
- #endregion
- }
-}
diff --git a/src/DevHive.Data/Repositories/FeedRepository.cs b/src/DevHive.Data/Repositories/FeedRepository.cs
deleted file mode 100644
index 8d3e5e1..0000000
--- a/src/DevHive.Data/Repositories/FeedRepository.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using AutoMapper.Internal;
-using DevHive.Data.Interfaces.Repositories;
-using DevHive.Data.Models;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.Repositories
-{
- public class FeedRepository : IFeedRepository
- {
- private readonly DevHiveContext _context;
-
- public FeedRepository(DevHiveContext context)
- {
- this._context = context;
- }
-
- /// <summary>
- /// This returns a given amount of posts of all given friends, created before "firstRequestIssued",
- /// ordered from latest to oldest (time created).
- /// PageSize specifies how many posts to get, and pageNumber specifices how many posts to skip (pageNumber * pageSize).
- ///
- /// This method is used in the feed page.
- /// Posts from friends are meant to be gotten in chunks, meaning you get X posts, and then get another amount of posts,
- /// that are after the first X posts.
- /// </summary>
- public async Task<List<Post>> GetFriendsPosts(List<User> friendsList, DateTime firstRequestIssued, int pageNumber, int pageSize)
- {
- List<Guid> friendsIds = friendsList.Select(f => f.Id).ToList();
-
- List<Post> posts = await this._context.Posts
- .Where(post => post.TimeCreated < firstRequestIssued)
- .Where(p => friendsIds.Contains(p.Creator.Id))
- .ToListAsync();
-
- // Ordering by descending can't happen in query, because it doesn't order it
- // completely correctly (example: in query these two times are ordered
- // like this: 2021-01-30T11:49:45, 2021-01-28T21:37:40.701244)
- posts = posts
- .OrderByDescending(x => x.TimeCreated.ToFileTime())
- .Skip((pageNumber - 1) * pageSize)
- .Take(pageSize)
- .ToList();
-
- return posts;
- }
-
- /// <summary>
- /// This returns a given amount of posts, that a user has made, created before "firstRequestIssued",
- /// ordered from latest to oldest (time created).
- /// PageSize specifies how many posts to get, and pageNumber specifices how many posts to skip (pageNumber * pageSize).
- ///
- /// This method is used in the profile page.
- /// Posts from friends are meant to be gotten in chunks, meaning you get X posts, and then get another amount of posts,
- /// that are after the first X posts.
- /// </summary>
- public async Task<List<Post>> GetUsersPosts(User user, DateTime firstRequestIssued, int pageNumber, int pageSize)
- {
- List<Post> posts = await this._context.Posts
- .Where(post => post.TimeCreated < firstRequestIssued)
- .Where(p => p.Creator.Id == user.Id)
- .ToListAsync();
-
- // Look at GetFriendsPosts on why this is done like this
- posts = posts
- .OrderByDescending(x => x.TimeCreated.ToFileTime())
- .Skip((pageNumber - 1) * pageSize)
- .Take(pageSize)
- .ToList();
-
- return posts;
- }
- }
-}
diff --git a/src/DevHive.Data/Repositories/LanguageRepository.cs b/src/DevHive.Data/Repositories/LanguageRepository.cs
deleted file mode 100644
index 31d0b86..0000000
--- a/src/DevHive.Data/Repositories/LanguageRepository.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using DevHive.Data.Interfaces.Repositories;
-using DevHive.Data.Models;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.Repositories
-{
- public class LanguageRepository : BaseRepository<Language>, ILanguageRepository
- {
- private readonly DevHiveContext _context;
-
- public LanguageRepository(DevHiveContext context)
- : base(context)
- {
- this._context = context;
- }
-
- #region Read
- public async Task<Language> GetByNameAsync(string languageName)
- {
- return await this._context.Languages
- .FirstOrDefaultAsync(x => x.Name == languageName);
- }
-
- /// <summary>
- /// Returns all technologies that exist in the database
- /// </summary>
- public HashSet<Language> GetLanguages()
- {
- return this._context.Languages.ToHashSet();
- }
- #endregion
-
- #region Validations
- public async Task<bool> DoesLanguageNameExistAsync(string languageName)
- {
- return await this._context.Languages
- .AsNoTracking()
- .AnyAsync(r => r.Name == languageName);
- }
-
- public async Task<bool> DoesLanguageExistAsync(Guid id)
- {
- return await this._context.Languages
- .AsNoTracking()
- .AnyAsync(r => r.Id == id);
- }
- #endregion
- }
-}
diff --git a/src/DevHive.Data/Repositories/PostRepository.cs b/src/DevHive.Data/Repositories/PostRepository.cs
deleted file mode 100644
index 52c5b4e..0000000
--- a/src/DevHive.Data/Repositories/PostRepository.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using DevHive.Data.Interfaces.Repositories;
-using DevHive.Data.Models;
-using DevHive.Data.RelationModels;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.Repositories
-{
- public class PostRepository : BaseRepository<Post>, IPostRepository
- {
- private readonly DevHiveContext _context;
- private readonly IUserRepository _userRepository;
-
- public PostRepository(DevHiveContext context, IUserRepository userRepository)
- : base(context)
- {
- this._context = context;
- this._userRepository = userRepository;
- }
-
- public async Task<bool> AddNewPostToCreator(Guid userId, Post post)
- {
- User user = await this._userRepository.GetByIdAsync(userId);
- user.Posts.Add(post);
-
- return await this.SaveChangesAsync();
- }
-
- #region Read
- public override async Task<Post> GetByIdAsync(Guid id)
- {
- return await this._context.Posts
- .Include(x => x.Comments)
- .Include(x => x.Creator)
- .Include(x => x.Attachments)
- // .Include(x => x.Rating)
- .FirstOrDefaultAsync(x => x.Id == id);
- }
-
- /// <summary>
- /// This method returns the post that is made at exactly the given time and by the given creator
- /// </summary>
- public async Task<Post> GetPostByCreatorAndTimeCreatedAsync(Guid creatorId, DateTime timeCreated)
- {
- return await this._context.Posts
- .FirstOrDefaultAsync(p => p.Creator.Id == creatorId &&
- p.TimeCreated == timeCreated);
- }
-
- public async Task<List<string>> GetFileUrls(Guid postId)
- {
- return (await this.GetByIdAsync(postId)).Attachments.Select(x => x.FileUrl).ToList();
- }
- #endregion
-
- #region Update
- public override async Task<bool> EditAsync(Guid id, Post newEntity)
- {
- Post post = await this.GetByIdAsync(id);
- // var ratingId = post.Rating.Id;
-
- this._context
- .Entry(post)
- .CurrentValues
- .SetValues(newEntity);
-
- List<PostAttachments> postAttachments = new();
- foreach(var attachment in newEntity.Attachments)
- postAttachments.Add(attachment);
- post.Attachments = postAttachments;
-
- post.Comments.Clear();
- foreach(var comment in newEntity.Comments)
- post.Comments.Add(comment);
-
- // post.Rating.Id = ratingId;
-
- this._context.Entry(post).State = EntityState.Modified;
-
- return await this.SaveChangesAsync();
- }
- #endregion
-
- #region Validations
- public async Task<bool> DoesPostExist(Guid postId)
- {
- return await this._context.Posts
- .AsNoTracking()
- .AnyAsync(r => r.Id == postId);
- }
-
- public async Task<bool> DoesPostHaveFiles(Guid postId)
- {
- return await this._context.Posts
- .AsNoTracking()
- .Where(x => x.Id == postId)
- .Select(x => x.Attachments)
- .AnyAsync();
- }
- #endregion
- }
-}
diff --git a/src/DevHive.Data/Repositories/RatingRepository.cs b/src/DevHive.Data/Repositories/RatingRepository.cs
deleted file mode 100644
index 1be8fe8..0000000
--- a/src/DevHive.Data/Repositories/RatingRepository.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-using System.Linq;
-using System.Threading.Tasks;
-using DevHive.Data.Interfaces.Repositories;
-using DevHive.Data.Models;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.Repositories
-{
- public class RatingRepository : BaseRepository<Rating>, IRatingRepository
- {
- private readonly DevHiveContext _context;
- private readonly IPostRepository _postRepository;
-
- public RatingRepository(DevHiveContext context, IPostRepository postRepository)
- : base(context)
- {
- this._context = context;
- this._postRepository = postRepository;
- }
-
- public async Task<Rating> GetRatingByPostId(Guid postId)
- {
- return await this._context.Rating
- .FirstOrDefaultAsync(x => x.Post.Id == postId);
- }
-
- public async Task<bool> UserRatedPost(Guid userId, Guid postId)
- {
- return await this._context.UserRate
- .Where(x => x.Post.Id == postId)
- .AnyAsync(x => x.User.Id == userId);
- }
- }
-}
diff --git a/src/DevHive.Data/Repositories/RoleRepository.cs b/src/DevHive.Data/Repositories/RoleRepository.cs
deleted file mode 100644
index 441efef..0000000
--- a/src/DevHive.Data/Repositories/RoleRepository.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using DevHive.Data.Interfaces.Repositories;
-using DevHive.Data.Models;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.Repositories
-{
- public class RoleRepository : BaseRepository<Role>, IRoleRepository
- {
- private readonly DevHiveContext _context;
-
- public RoleRepository(DevHiveContext context)
- : base(context)
- {
- this._context = context;
- }
-
- #region Read
- public async Task<Role> GetByNameAsync(string name)
- {
- return await this._context.Roles
- .FirstOrDefaultAsync(x => x.Name == name);
- }
- #endregion
-
- public override async Task<bool> EditAsync(Guid id, Role newEntity)
- {
- Role role = await this.GetByIdAsync(id);
-
- this._context
- .Entry(role)
- .CurrentValues
- .SetValues(newEntity);
-
- return await this.SaveChangesAsync();
- }
-
- #region Validations
- public async Task<bool> DoesNameExist(string name)
- {
- return await this._context.Roles
- .AsNoTracking()
- .AnyAsync(r => r.Name == name);
- }
-
- public async Task<bool> DoesRoleExist(Guid id)
- {
- return await this._context.Roles
- .AsNoTracking()
- .AnyAsync(r => r.Id == id);
- }
- #endregion
- }
-}
diff --git a/src/DevHive.Data/Repositories/TechnologyRepository.cs b/src/DevHive.Data/Repositories/TechnologyRepository.cs
deleted file mode 100644
index 6f0d10f..0000000
--- a/src/DevHive.Data/Repositories/TechnologyRepository.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using DevHive.Data.Interfaces.Repositories;
-using DevHive.Data.Models;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.Repositories
-{
- public class TechnologyRepository : BaseRepository<Technology>, ITechnologyRepository
- {
- private readonly DevHiveContext _context;
-
- public TechnologyRepository(DevHiveContext context)
- : base(context)
- {
- this._context = context;
- }
-
- #region Read
- public async Task<Technology> GetByNameAsync(string technologyName)
- {
- return await this._context.Technologies
- .FirstOrDefaultAsync(x => x.Name == technologyName);
- }
-
- /// <summary>
- /// Returns all technologies that exist in the database
- /// </summary>
- public HashSet<Technology> GetTechnologies()
- {
- return this._context.Technologies.ToHashSet();
- }
- #endregion
-
- #region Validations
- public async Task<bool> DoesTechnologyNameExistAsync(string technologyName)
- {
- return await this._context.Technologies
- .AsNoTracking()
- .AnyAsync(r => r.Name == technologyName);
- }
-
- public async Task<bool> DoesTechnologyExistAsync(Guid id)
- {
- return await this._context.Technologies
- .AsNoTracking()
- .AnyAsync(x => x.Id == id);
- }
- #endregion
- }
-}
diff --git a/src/DevHive.Data/Repositories/UserRepository.cs b/src/DevHive.Data/Repositories/UserRepository.cs
deleted file mode 100644
index 6e97e60..0000000
--- a/src/DevHive.Data/Repositories/UserRepository.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Threading.Tasks;
-using AutoMapper.Mappers;
-using DevHive.Data.Interfaces.Repositories;
-using DevHive.Data.Models;
-using DevHive.Data.RelationModels;
-using Microsoft.AspNetCore.Identity;
-using Microsoft.EntityFrameworkCore;
-
-namespace DevHive.Data.Repositories
-{
- public class UserRepository : BaseRepository<User>, IUserRepository
- {
- private readonly DevHiveContext _context;
-
- public UserRepository(DevHiveContext context)
- : base(context)
- {
- this._context = context;
- }
-
- #region Read
- public override async Task<User> GetByIdAsync(Guid id)
- {
- return await this._context.Users
- .Include(x => x.Roles)
- .Include(x => x.Languages)
- .Include(x => x.Technologies)
- .Include(x => x.Posts)
- .Include(x => x.Friends)
- .Include(x => x.ProfilePicture)
- .FirstOrDefaultAsync(x => x.Id == id);
- }
-
- public async Task<User> GetByUsernameAsync(string username)
- {
- return await this._context.Users
- .Include(x => x.Roles)
- .Include(x => x.Languages)
- .Include(x => x.Technologies)
- .Include(x => x.Posts)
- .Include(x => x.Friends)
- .Include(x => x.ProfilePicture)
- .FirstOrDefaultAsync(x => x.UserName == username);
- }
- #endregion
-
- #region Update
- public async Task<bool> UpdateProfilePicture(Guid userId, string pictureUrl)
- {
- User user = await this.GetByIdAsync(userId);
-
- user.ProfilePicture.PictureURL = pictureUrl;
-
- return await this.SaveChangesAsync();
- }
- #endregion
-
- #region Validations
- public async Task<bool> DoesUserExistAsync(Guid id)
- {
- return await this._context.Users
- .AsNoTracking()
- .AnyAsync(x => x.Id == id);
- }
-
- public async Task<bool> DoesUsernameExistAsync(string username)
- {
- return await this._context.Users
- .AsNoTracking()
- .AnyAsync(u => u.UserName == username);
- }
-
- public async Task<bool> DoesEmailExistAsync(string email)
- {
- return await this._context.Users
- .AsNoTracking()
- .AnyAsync(u => u.Email == email);
- }
-
- public async Task<bool> ValidateFriendsCollectionAsync(List<string> usernames)
- {
- bool valid = true;
-
- foreach (var username in usernames)
- {
- if (!await this._context.Users.AnyAsync(x => x.UserName == username))
- {
- valid = false;
- break;
- }
- }
- return valid;
- }
-
- public bool DoesUserHaveThisUsername(Guid id, string username)
- {
- return this._context.Users
- .AsNoTracking()
- .Any(x => x.Id == id &&
- x.UserName == username);
- }
- #endregion
- }
-}