├── README.md ├── Domain ├── Entities │ ├── Languages.cs │ ├── Organization.cs │ ├── Follower.cs │ ├── Following.cs │ ├── Star.cs │ ├── OrganizationMember.cs │ ├── User.cs │ └── Repository.cs ├── Enums │ └── Privacy_Status.cs ├── Commons │ └── Auditable.cs └── Domain.csproj ├── Service ├── Helpers │ └── Response.cs ├── DTOs │ ├── UserForCreationDto.cs │ ├── OrganizationDto.cs │ └── UserDto.cs ├── Mappers │ └── MappingProfile.cs ├── Service.csproj ├── Interfaces │ ├── IUserService.cs │ └── IOrganizationService.cs └── Services │ ├── UserService.cs │ └── OrganizationService.cs ├── Data ├── IRepositories │ ├── IUserRepository.cs │ ├── IOrganizationMember.cs │ ├── IOrganizationRepository.cs │ ├── RepoRepository.cs │ ├── IFollowingRepository.cs │ └── IFolllowerRepository.cs ├── Migrations │ ├── 20230317214900_SecondMission.cs │ ├── 20230317203758_Initial.cs │ ├── AppDbContextModelSnapshot.cs │ ├── 20230317203758_Initial.Designer.cs │ └── 20230317214900_SecondMission.Designer.cs ├── Context │ └── AppDbContext.cs ├── Data.csproj └── Repositories │ ├── UserRepository.cs │ ├── OrganisationMemberRepository.cs │ ├── OrganizationRepository.cs │ ├── FollowingRepository.cs │ ├── FollowerRepository.cs │ └── RepoRepository.cs ├── Github_Project ├── Program.cs └── Github_Project.csproj ├── LICENSE.txt ├── Github_Project_Solution.sln ├── .gitattributes └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | # Github_Project_Solution -------------------------------------------------------------------------------- /Domain/Entities/Languages.cs: -------------------------------------------------------------------------------- 1 | namespace Domain.Entities 2 | { 3 | public class Languages 4 | { 5 | public int Id { get; set; } 6 | public string Name { get; set; } 7 | public long RepositoryId { get; set; } 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Domain/Enums/Privacy_Status.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Domain.Enums 8 | { 9 | public enum Privacy_Status 10 | { 11 | Public = 10, 12 | Private = 20 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Domain/Entities/Organization.cs: -------------------------------------------------------------------------------- 1 | using Domain.Commons; 2 | 3 | namespace Domain.Entities 4 | { 5 | public class Organization : Auditable 6 | { 7 | public string Name { get; set; } 8 | public string Description { get; set; } 9 | public List organizationMembers { get; set; } 10 | public List Repositories { get; set; } 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Service/Helpers/Response.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Service.Helpers 8 | { 9 | public class Response 10 | { 11 | public int StatusCode { get; set; } 12 | public string Message { get; set; } 13 | public TResult Value { get; set; } 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Domain/Entities/Follower.cs: -------------------------------------------------------------------------------- 1 | using Domain.Commons; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Domain.Entities 9 | { 10 | public class Follower : Auditable 11 | { 12 | public long UserId 13 | { 14 | get; set; 15 | } 16 | public User User { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Domain/Entities/Following.cs: -------------------------------------------------------------------------------- 1 | using Domain.Commons; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Domain.Entities 9 | { 10 | public class Following : Auditable 11 | { 12 | public long UserId 13 | { 14 | get; set; 15 | } 16 | public User User { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Service/DTOs/UserForCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Service.DTOs 2 | { 3 | public class UserForCreationDto 4 | { 5 | 6 | public string FirstName { get; set; } 7 | public string LastName { get; set; } 8 | public string Description { get; set; } 9 | public string Email { get; set; } 10 | public string Password { get; set; } 11 | public string Username { get; set; } 12 | 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /Data/IRepositories/IUserRepository.cs: -------------------------------------------------------------------------------- 1 | using Domain.Entities; 2 | 3 | namespace Data.IRepositories 4 | { 5 | public interface IUserRepository 6 | { 7 | ValueTask InsertUserAsync(User user); 8 | ValueTask UpdateUserAsync(User user); 9 | ValueTask DeleteUserAysnyc(long id); 10 | ValueTask SelectUserAsync(Predicate predicate); 11 | IQueryable SelectAllAsync(); 12 | } 13 | } -------------------------------------------------------------------------------- /Domain/Entities/Star.cs: -------------------------------------------------------------------------------- 1 | using Domain.Commons; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Domain.Entities 9 | { 10 | public class Star : Auditable 11 | { 12 | public long UserId { get; set; } 13 | public User User { get; set; } 14 | public long RepositoryId { get; set; } 15 | public Repository Repository { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Domain/Commons/Auditable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Domain.Commons 9 | { 10 | public abstract class Auditable 11 | { 12 | [Key] 13 | public long Id { get; set; } 14 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 15 | public DateTime? UpdatedAt { get; set;} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Service/Mappers/MappingProfile.cs: -------------------------------------------------------------------------------- 1 | 2 | using AutoMapper; 3 | using Domain.Entities; 4 | using Service.DTOs; 5 | 6 | 7 | namespace Service.Mappers 8 | { 9 | public class MappingProfile : Profile 10 | { 11 | 12 | public MappingProfile() 13 | { 14 | CreateMap().ReverseMap(); 15 | CreateMap().ReverseMap(); 16 | CreateMap().ReverseMap(); 17 | } 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /Domain/Entities/OrganizationMember.cs: -------------------------------------------------------------------------------- 1 | using Domain.Commons; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Domain.Entities 9 | { 10 | public class OrganizationMember : Auditable 11 | { 12 | public long UserId { get; set; } 13 | public User User { get; set; } 14 | public long OrganizationId { get; set; } 15 | public Organization Organization { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Service/DTOs/OrganizationDto.cs: -------------------------------------------------------------------------------- 1 | using Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Service.DTOs 9 | { 10 | public class OrganizationDto 11 | { 12 | public string Name { get; set; } 13 | public string Description { get; set; } 14 | public List organizationMembers { get; set; } 15 | public List Repositories { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Domain/Entities/User.cs: -------------------------------------------------------------------------------- 1 | using Domain.Commons; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace Domain.Entities 5 | { 6 | public class User : Auditable 7 | { 8 | public string FirstName { get; set; } 9 | public string LastName { get; set; } 10 | public string? Description { get; set; } 11 | public string Username { get; set; } 12 | public string Email { get; set; } 13 | [Required, MinLength(4)] 14 | public string Password { get; set; } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Data/Migrations/20230317214900_SecondMission.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Data.Migrations 6 | { 7 | /// 8 | public partial class SecondMission : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | 14 | } 15 | 16 | /// 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Service/Service.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Data/IRepositories/IOrganizationMember.cs: -------------------------------------------------------------------------------- 1 | using Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Data.IRepositories 9 | { 10 | public interface IOrganizationMember 11 | { 12 | ValueTask InsertAsync(User user); 13 | ValueTask ModifyAsync(User user); 14 | ValueTask RemoveAsync( long id); 15 | ValueTask Select(Predicate predicate); 16 | IQueryable SelectAll(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Data/IRepositories/IOrganizationRepository.cs: -------------------------------------------------------------------------------- 1 | using Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Data.IRepositories 9 | { 10 | public interface IOrganizationRepository 11 | { 12 | ValueTask InsertAsync(Organization organization); 13 | ValueTask ModifyAsync(Organization organization); 14 | ValueTask RemoveAsync(long id); 15 | ValueTask Select(Predicate predicate); 16 | IQueryable SelectAll(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Data/IRepositories/RepoRepository.cs: -------------------------------------------------------------------------------- 1 | using Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Data.IRepositories 9 | { 10 | public interface IRepRepository 11 | { 12 | ValueTask InsertRepositoryAsync(Repository rep); 13 | ValueTask UpdateRepositoryAsync(Repository rep); 14 | ValueTask DeleteRepositoryAysnyc(long id); 15 | ValueTask SelectRepositoryAsync(Predicate predicate); 16 | IQueryable SelectAllRepositories(); 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /Data/IRepositories/IFollowingRepository.cs: -------------------------------------------------------------------------------- 1 | using Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Data.IRepositories 9 | { 10 | public interface IFollowingRepository 11 | { 12 | ValueTask InsertFolowingAsync(Following following); 13 | ValueTask UpdateFollwingAsync(Following following); 14 | ValueTask DeleteFollowingAsync(long id); 15 | ValueTask SelectFollowingAsync(Predicate predicate); 16 | IQueryable SelectAllFollowing(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Data/IRepositories/IFolllowerRepository.cs: -------------------------------------------------------------------------------- 1 | using Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Data.IRepositories 9 | { 10 | public interface IFolllowerRepository 11 | { 12 | ValueTask InsertFolowerAsync(Follower follower); 13 | ValueTask UpdateFollowerAsync(Follower follower); 14 | ValueTask DeleteFollowerAsync(long id); 15 | ValueTask SelectFollowerAsync(Predicate predicate); 16 | IQueryable SelectAllFollower(); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Domain/Entities/Repository.cs: -------------------------------------------------------------------------------- 1 | using Domain.Commons; 2 | using Domain.Enums; 3 | 4 | namespace Domain.Entities 5 | { 6 | public class Repository : Auditable 7 | { 8 | public string Name { get; set; } 9 | public string Description { get; set; } 10 | public Privacy_Status RepositoryType { get; set; } = Privacy_Status.Public; 11 | public int StarsCount { get; set; } = 0; 12 | public long UserId { get; set; } 13 | public User User { get; set; } 14 | 15 | public long OrganizationId { get; set; } 16 | public Organization Organization { get; set; } 17 | 18 | public List Stars { get; set; } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Service/DTOs/UserDto.cs: -------------------------------------------------------------------------------- 1 | using Domain.Entities; 2 | 3 | namespace Service.DTOs 4 | { 5 | public class UserDto 6 | { 7 | public string FirstName { get; set; } 8 | public string LastName { get; set; } 9 | public string Username { get; set; } 10 | public string Description { get; set; } 11 | 12 | public static explicit operator UserDto(User user) 13 | { 14 | return new UserDto() 15 | { 16 | FirstName = user.FirstName, 17 | LastName = user.LastName, 18 | Username = user.Username, 19 | Description = user.Description 20 | }; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Service/Interfaces/IUserService.cs: -------------------------------------------------------------------------------- 1 | using Service.DTOs; 2 | using Service.Helpers; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Service.Interfaces 10 | { 11 | public interface IUserService 12 | { 13 | ValueTask> AddUserAsync(UserForCreationDto userForCreationDto); 14 | ValueTask> ModifyUserAsync(long id, UserForCreationDto userForCreationDto); 15 | ValueTask> DeleteUserAsync(long id); 16 | ValueTask> GetUserByIdAsync(long id); 17 | ValueTask>> GetAllUserAsync(); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Service/Interfaces/IOrganizationService.cs: -------------------------------------------------------------------------------- 1 | using Service.DTOs; 2 | using Service.Helpers; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Service.Interfaces 10 | { 11 | public interface IOrganizationService 12 | { 13 | ValueTask> AddUserAsync(OrganizationDto OrganizationDto); 14 | ValueTask> ModifyUserAsync(long id, OrganizationDto userForCreationDto); 15 | ValueTask> DeleteUserAsync(long id); 16 | ValueTask> GetUserByIdAsync(long id); 17 | ValueTask>> GetAllUserAsync(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Github_Project/Program.cs: -------------------------------------------------------------------------------- 1 | using Data.Repositories; 2 | using Domain.Entities; 3 | using System; 4 | namespace Github_Project; 5 | public class Program 6 | { 7 | public static async Task Main (string[] args) 8 | { 9 | OrganizationRepository organizationRepository = new OrganizationRepository(); 10 | Organization organization = new Organization() 11 | { 12 | Id = 1, 13 | Name = "Apple", 14 | Description = "Blla", 15 | 16 | }; 17 | await organizationRepository.InsertAsync(organization); 18 | } 19 | 20 | } 21 | 22 | //User user = new User() 23 | //{ 24 | // FirstName= "Test", 25 | // LastName= "Testjonov", 26 | // Email = "Something#gmail", 27 | // Password = "12345678" 28 | //} -------------------------------------------------------------------------------- /Data/Context/AppDbContext.cs: -------------------------------------------------------------------------------- 1 | using Domain.Entities; 2 | using Microsoft.EntityFrameworkCore; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Data.Context 10 | { 11 | public class AppDbContext : DbContext 12 | { 13 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 14 | { 15 | optionsBuilder.UseNpgsql("Server = localhost; Database = Github_Project; User Id = postgres; password = 1968;"); 16 | } 17 | public DbSet Users { get; set; } 18 | public DbSet Repositories { get; set; } 19 | public DbSet Languages { get; set; } 20 | public DbSet Organizations { get; set; } 21 | public DbSet Stars { get; set; } 22 | public DbSet Followeres { get; set;} 23 | public DbSet Followings{ get; set; } 24 | 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Domain/Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | 18 | all 19 | runtime; build; native; contentfiles; analyzers; buildtransitive 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Data/Data.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | all 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Github_Project/Github_Project.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | all 20 | runtime; build; native; contentfiles; analyzers; buildtransitive 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Data/Repositories/UserRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Context; 2 | using Data.IRepositories; 3 | using Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | 7 | 8 | namespace Data.Repositories 9 | { 10 | public class UserRepository : IUserRepository 11 | { 12 | private readonly AppDbContext appDbContext = new AppDbContext(); 13 | 14 | public async ValueTask InsertUserAsync(User user) 15 | { 16 | EntityEntry entity = await appDbContext.Users.AddAsync(user); 17 | await appDbContext.SaveChangesAsync(); 18 | return entity.Entity; 19 | } 20 | 21 | public async ValueTask UpdateUserAsync(User user) 22 | { 23 | EntityEntry entity = appDbContext.Users.Update(user); 24 | await appDbContext.SaveChangesAsync(); 25 | return entity.Entity; 26 | } 27 | 28 | public async ValueTask DeleteUserAysnyc(long id) 29 | { 30 | var entity = await appDbContext.Users.FirstOrDefaultAsync(user => user.Id.Equals(id)); 31 | if (entity is null) 32 | return false; 33 | 34 | appDbContext.Users.Remove(entity); 35 | await appDbContext.SaveChangesAsync(); 36 | return true; 37 | } 38 | 39 | public async ValueTask SelectUserAsync(Predicate predicate) => await appDbContext.Users.FirstOrDefaultAsync(id => predicate(id)); 40 | 41 | public IQueryable SelectAllAsync() => appDbContext.Users; 42 | 43 | } 44 | } -------------------------------------------------------------------------------- /Data/Repositories/OrganisationMemberRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Context; 2 | using Data.IRepositories; 3 | using Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace Data.Repositories 13 | { 14 | public class OrganisationMemberRepository : IOrganizationMember 15 | { 16 | private readonly AppDbContext appDbContext = new AppDbContext(); 17 | public async ValueTask InsertAsync(User user) 18 | { 19 | EntityEntry entity = await this.appDbContext.Users.AddAsync(user); 20 | await appDbContext.SaveChangesAsync(); 21 | return entity.Entity; 22 | } 23 | 24 | 25 | public async ValueTask ModifyAsync(User user) 26 | { 27 | EntityEntry entity = this.appDbContext.Users.Update(user); 28 | await appDbContext.SaveChangesAsync(); 29 | return entity.Entity; 30 | } 31 | 32 | public async ValueTask RemoveAsync(long id) 33 | { 34 | User entity = 35 | await this.appDbContext.Users.FirstOrDefaultAsync(user => user.Id.Equals(id)); 36 | if (entity is null) 37 | return false; 38 | 39 | this.appDbContext.Users.Remove(entity); 40 | await this.appDbContext.SaveChangesAsync(); 41 | return true; 42 | } 43 | 44 | public async ValueTask Select(Predicate predicate) => 45 | 46 | await this.appDbContext.Users.FirstOrDefaultAsync(user => predicate(user)); 47 | 48 | 49 | public IQueryable SelectAll() => this.appDbContext.Users; 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Data/Repositories/OrganizationRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Context; 2 | using Data.IRepositories; 3 | using Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace Data.Repositories 13 | { 14 | public class OrganizationRepository : IOrganizationRepository 15 | { 16 | private readonly AppDbContext appDbContext = new AppDbContext(); 17 | public async ValueTask InsertAsync(Organization organization) 18 | { 19 | EntityEntry entity = await this.appDbContext.Organizations.AddAsync(organization); 20 | await appDbContext.SaveChangesAsync(); 21 | return entity.Entity; 22 | } 23 | 24 | 25 | 26 | public async ValueTask ModifyAsync(Organization organization) 27 | { 28 | EntityEntry entity = this.appDbContext.Organizations.Update(organization); 29 | await appDbContext.SaveChangesAsync(); 30 | return entity.Entity; 31 | } 32 | 33 | public async ValueTask RemoveAsync(long id) 34 | { 35 | Organization entity = 36 | await this.appDbContext.Organizations.FirstOrDefaultAsync(O => O.Id.Equals(id)); 37 | if (entity is null) 38 | return false; 39 | 40 | this.appDbContext.Organizations.Remove(entity); 41 | await this.appDbContext.SaveChangesAsync(); 42 | return true; 43 | } 44 | 45 | 46 | public async ValueTask Select(Predicate predicate) => 47 | await this.appDbContext.Organizations.FirstOrDefaultAsync(name => predicate(name)); 48 | 49 | 50 | public IQueryable SelectAll() => this.appDbContext.Organizations; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Data/Repositories/FollowingRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Context; 2 | using Domain.Entities; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.ChangeTracking; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace Data.Repositories 12 | { 13 | public class FollowingRepository 14 | { 15 | private readonly AppDbContext appDbContext = new AppDbContext(); 16 | 17 | public async ValueTask InsertFolowingAsync(Following following) 18 | { 19 | EntityEntry entity = await this.appDbContext.Followings.AddAsync(following); 20 | await appDbContext.SaveChangesAsync(); 21 | return entity.Entity; 22 | } 23 | 24 | public IQueryable SelectAllFollowing() 25 | { 26 | var query = "select * from \"Followeres\""; 27 | return this.appDbContext.Followings.FromSqlRaw(query); 28 | } 29 | 30 | public async ValueTask SelectFollowerAsync(Predicate predicate) => 31 | await this.appDbContext.Followeres.FirstOrDefaultAsync(following => predicate(following)); 32 | public async ValueTask DeleteFollowerAsync(long id) 33 | { 34 | Follower entity = await this.appDbContext.Followeres.FirstOrDefaultAsync(follow => follow.Id.Equals(id)); 35 | if (entity is null) 36 | return false; 37 | 38 | this.appDbContext.Followeres.Remove(entity); 39 | await this.appDbContext.SaveChangesAsync(); 40 | return true; 41 | } 42 | 43 | public async ValueTask UpdateFollowingAsync(Following following) 44 | { 45 | EntityEntry entity = this.appDbContext.Followings.Update(following); 46 | await appDbContext.SaveChangesAsync(); 47 | return entity.Entity; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Data/Repositories/FollowerRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Context; 2 | using Data.IRepositories; 3 | using Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace Data.Repositories 13 | { 14 | public class FollowerRepository : IFolllowerRepository 15 | { 16 | private readonly AppDbContext appDbContext = new AppDbContext(); 17 | 18 | public async ValueTask InsertFolowerAsync(Follower follower) 19 | { 20 | EntityEntry entity = await this.appDbContext.Followeres.AddAsync(follower); 21 | await appDbContext.SaveChangesAsync(); 22 | return entity.Entity; 23 | } 24 | 25 | public IQueryable SelectAllFollower() 26 | { 27 | var query = "select * from \"Followeres\""; 28 | return this.appDbContext.Followeres.FromSqlRaw(query); 29 | } 30 | 31 | public async ValueTask SelectFollowerAsync(Predicate predicate) => 32 | await this.appDbContext.Followeres.FirstOrDefaultAsync(follower => predicate(follower)); 33 | public async ValueTask DeleteFollowerAsync(long id) 34 | { 35 | Follower entity = await this.appDbContext.Followeres.FirstOrDefaultAsync(follow => follow.Id.Equals(id)); 36 | if (entity is null) 37 | return false; 38 | 39 | this.appDbContext.Followeres.Remove(entity); 40 | await this.appDbContext.SaveChangesAsync(); 41 | return true; 42 | } 43 | 44 | public async ValueTask UpdateFollowerAsync(Follower follower) 45 | { 46 | EntityEntry entity = this.appDbContext.Followeres.Update(follower); 47 | await appDbContext.SaveChangesAsync(); 48 | return entity.Entity; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Data/Repositories/RepoRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Context; 2 | using Domain.Entities; 3 | using Microsoft.EntityFrameworkCore.ChangeTracking; 4 | using Microsoft.EntityFrameworkCore; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using Data.IRepositories; 11 | 12 | namespace Data.Repositories 13 | { 14 | public class RepRepository : IRepRepository 15 | { 16 | private readonly AppDbContext appDbContext = new AppDbContext(); 17 | 18 | public async ValueTask InsertRepositoryAsync(Repository repository) 19 | { 20 | EntityEntry entity = await this.appDbContext.Repositories.AddAsync(repository); 21 | await appDbContext.SaveChangesAsync(); 22 | return entity.Entity; 23 | } 24 | 25 | public async ValueTask UpdateRepositoryAsync(Repository repository) 26 | { 27 | EntityEntry entity = this.appDbContext.Repositories.Update(repository); 28 | await appDbContext.SaveChangesAsync(); 29 | return entity.Entity; 30 | } 31 | 32 | public async ValueTask DeleteRepositoryAysnyc(long id) 33 | { 34 | Repository entity = await this.appDbContext.Repositories.FirstOrDefaultAsync(repo => repo.Id.Equals(id)); 35 | if (entity is null) 36 | return false; 37 | 38 | this.appDbContext.Repositories.Remove(entity); 39 | await this.appDbContext.SaveChangesAsync(); 40 | return true; 41 | } 42 | 43 | public async ValueTask SelectRepositoryAsync(Predicate predicate) => 44 | await this.appDbContext.Repositories.FirstOrDefaultAsync(repo => predicate(repo)); 45 | 46 | public IQueryable SelectAllRepositories() 47 | { 48 | var query = "select * from \"Repositories\""; 49 | return this.appDbContext.Repositories.FromSqlRaw(query); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Github_Project_Solution.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33205.214 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Github_Project", "Github_Project\Github_Project.csproj", "{B0DDABB1-45F9-4059-8A2E-723AE05BC9CE}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Domain\Domain.csproj", "{DDB6FF01-96CC-444A-88DA-BB4B690B1748}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Data\Data.csproj", "{C494D38E-BBCA-4F12-9F03-B4965AEA1608}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Service", "Service\Service.csproj", "{E07C1779-C817-4EEF-9642-2D1FD35A18EF}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {B0DDABB1-45F9-4059-8A2E-723AE05BC9CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {B0DDABB1-45F9-4059-8A2E-723AE05BC9CE}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {B0DDABB1-45F9-4059-8A2E-723AE05BC9CE}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {B0DDABB1-45F9-4059-8A2E-723AE05BC9CE}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {DDB6FF01-96CC-444A-88DA-BB4B690B1748}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {DDB6FF01-96CC-444A-88DA-BB4B690B1748}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {DDB6FF01-96CC-444A-88DA-BB4B690B1748}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {DDB6FF01-96CC-444A-88DA-BB4B690B1748}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {C494D38E-BBCA-4F12-9F03-B4965AEA1608}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {C494D38E-BBCA-4F12-9F03-B4965AEA1608}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {C494D38E-BBCA-4F12-9F03-B4965AEA1608}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {C494D38E-BBCA-4F12-9F03-B4965AEA1608}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {E07C1779-C817-4EEF-9642-2D1FD35A18EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {E07C1779-C817-4EEF-9642-2D1FD35A18EF}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {E07C1779-C817-4EEF-9642-2D1FD35A18EF}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {E07C1779-C817-4EEF-9642-2D1FD35A18EF}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {1ABE8983-9B09-4604-AAE6-8B0EAAFAFDC3} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Service/Services/UserService.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Azure; 3 | using Data.IRepositories; 4 | using Data.Repositories; 5 | using Domain.Entities; 6 | using Microsoft.EntityFrameworkCore; 7 | using Service.DTOs; 8 | using Service.Helpers; 9 | using Service.Interfaces; 10 | 11 | namespace Service.Services 12 | { 13 | public class UserService : IUserService 14 | { 15 | IUserRepository userRepo = new UserRepository(); 16 | private readonly IMapper mapper; 17 | public UserService(IMapper mapper) 18 | { 19 | this.mapper = mapper; 20 | } 21 | public async ValueTask> AddUserAsync(UserForCreationDto userForCreationDto) 22 | { 23 | var users = await userRepo.SelectUserAsync(users => users.Username.Equals(userForCreationDto.Username)); 24 | 25 | if (users is not null) 26 | return new Helpers.Response 27 | { 28 | StatusCode = 404, 29 | Message = "User is already existed", 30 | Value = (UserDto)users 31 | }; 32 | 33 | var addedUsers = await userRepo.InsertUserAsync(users); 34 | 35 | var mappedUser = this.mapper.Map(userForCreationDto); 36 | var addedUser = await this.userRepo.InsertUserAsync(mappedUser); 37 | var resultDto = this.mapper.Map(addedUser); 38 | return new Helpers.Response 39 | { 40 | StatusCode = 200, 41 | Message = "Success", 42 | Value = resultDto 43 | }; 44 | } 45 | 46 | public async ValueTask> ModifyUserAsync(long id, UserForCreationDto userForCreationDto) 47 | { 48 | var user = await userRepo.SelectUserAsync(user => user.Id.Equals(id)); 49 | if (user is null) 50 | return new Helpers.Response 51 | { 52 | StatusCode = 404, 53 | Message = "Couldn't find for given ID", 54 | Value = null 55 | }; 56 | 57 | var updatedUser = await this.userRepo.UpdateUserAsync(user); 58 | var mappedUsers = this.mapper.Map(updatedUser); 59 | return new Helpers.Response 60 | { 61 | StatusCode = 200, 62 | Message = "Success", 63 | Value = mappedUsers 64 | }; 65 | } 66 | 67 | 68 | 69 | public async ValueTask> DeleteUserAsync(long id) 70 | { 71 | var user = await userRepo.SelectUserAsync(user => user.Id.Equals(id)); 72 | 73 | if (user is null) 74 | return new Helpers.Response 75 | { 76 | StatusCode = 404, 77 | Message = "Couldn't find for given ID", 78 | Value = false 79 | }; 80 | 81 | await this.userRepo.DeleteUserAysnyc(id); 82 | return new Helpers.Response 83 | { 84 | StatusCode = 200, 85 | Message = "Success", 86 | Value = true 87 | }; 88 | } 89 | 90 | public async ValueTask> GetUserByIdAsync(long id) 91 | { 92 | User user = await userRepo.SelectUserAsync(user => user.Id.Equals(id)); 93 | if (user is null) 94 | return new Helpers.Response 95 | { 96 | StatusCode = 404, 97 | Message = "Couldn't find for given ID", 98 | Value = null 99 | }; 100 | 101 | var mappedUsers = mapper.Map(user); 102 | return new Helpers.Response 103 | { 104 | StatusCode = 200, 105 | Message = "Success", 106 | Value = mappedUsers 107 | }; 108 | } 109 | 110 | public async ValueTask>> GetAllUserAsync() 111 | { 112 | var users = await userRepo.SelectAllAsync().ToListAsync(); 113 | if (users.Any()) 114 | return new Helpers.Response> 115 | { 116 | StatusCode = 404, 117 | Message = "Not found", 118 | Value = null 119 | }; 120 | 121 | var mappedUser = mapper.Map>(users); 122 | return new Helpers.Response> 123 | { 124 | StatusCode = 200, 125 | Message = "Success", 126 | Value = mappedUser 127 | }; 128 | 129 | } 130 | 131 | } 132 | } -------------------------------------------------------------------------------- /Service/Services/OrganizationService.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Data.IRepositories; 3 | using Data.Repositories; 4 | using Domain.Entities; 5 | 6 | using Service.DTOs; 7 | using Service.Helpers; 8 | using Service.Interfaces; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | using System.Threading.Tasks; 14 | 15 | namespace GitApp.Service.Services 16 | { 17 | // public class OrganisationService : IOrganizationService 18 | // { 19 | // public ValueTask> AddUserAsync(OrganizationDto OrganizationDto) 20 | // { 21 | // throw new NotImplementedException(); 22 | // } 23 | 24 | // public ValueTask> DeleteUserAsync(long id) 25 | // { 26 | // throw new NotImplementedException(); 27 | // } 28 | 29 | // public ValueTask>> GetAllUserAsync() 30 | // { 31 | // throw new NotImplementedException(); 32 | // } 33 | 34 | // public ValueTask> GetUserByIdAsync(long id) 35 | // { 36 | // throw new NotImplementedException(); 37 | // } 38 | 39 | // public ValueTask> ModifyUserAsync(long id, OrganizationDto userForCreationDto) 40 | // { 41 | // throw new NotImplementedException(); 42 | // } 43 | // } 44 | //} 45 | using System; 46 | using System.Collections.Generic; 47 | using System.Linq; 48 | using System.Text; 49 | using System.Threading.Tasks; 50 | 51 | //namespace GitApp.Service.Services 52 | //{ 53 | // internal class OrganizationService : IOrganizationService 54 | // { 55 | // private readonly IOrganizationRepository OrganisationRepostory = new OrganizationRepository(); 56 | 57 | // private readonly IMapper mapper; 58 | // public OrganizationService(IMapper mapper) 59 | // { 60 | // this.mapper = mapper; 61 | } 62 | // public async ValueTask> AddUserAsync(OrganizationDto vOrganisationCDto) 63 | // { 64 | // ////var user = await this.OrganizationRepository.SelectAll(); 65 | // //var result = user.Any(user => user.Name.Equals(vOrganisationCDto.Name)); 66 | // if (result is true) 67 | // { 68 | // return new Response 69 | // { 70 | // StatusCode = 404, 71 | // Message = "User is already exits", 72 | // Value = (OrganizationDto)user 73 | // }; 74 | // } 75 | 76 | // var mappedOrganisation = this.mapper.Map(vOrganisationCDto); 77 | // var addedOrganisation = await this.OrganisationRepostory.InsertAsync(mappedOrganisation); 78 | // var resultLast = this.mapper.Map(addedOrganisation); 79 | 80 | // return new Response 81 | // { 82 | // StatusCode = 200, 83 | // Message = "Succes", 84 | // Value = (OrganizationDto)resultLast 85 | // }; 86 | // } 87 | 88 | // public async ValueTask> DeleteUserAsync(int id) 89 | // { 90 | // var user = await this.OrganisationRepostory.SelectOrganisationAsync(id); 91 | // if (user is null) 92 | // return new Response 93 | // { 94 | // Code = 404, 95 | // Message = "Not fount given Id", 96 | // Value = false 97 | // }; 98 | 99 | // await this.OrganisationRepostory.DeleteOrganisationAsync(id); 100 | // return new Response 101 | // { 102 | // Code = 200, 103 | // Message = "Success", 104 | // Value = true 105 | // }; 106 | // } 107 | 108 | // public async ValueTask>> GetAllUserAsync(string search = null) 109 | // { 110 | // var users = await this.OrganisationRepostory.SelectAllOrganisationAsync(); 111 | // var context = users.ToList(); 112 | // if (context.Any()) 113 | // return new Response> 114 | // { 115 | // Code = 404, 116 | // Message = "Success", 117 | // Value = null 118 | // }; 119 | 120 | // var result = users.Where(user => user.Name.Contains(search, StringComparison.OrdinalIgnoreCase)); 121 | // var mappedUsers = this.mapper.Map>(result); 122 | // return new Response> 123 | // { 124 | // Code = 200, 125 | // Message = "Success", 126 | // Value = mappedUsers 127 | // }; 128 | // } 129 | 130 | // public async ValueTask> GetUserByIdAsync(int id) 131 | // { 132 | // var users = await this.OrganisationRepostory.SelectOrganisationAsync(id); 133 | // if (users is null) 134 | // { 135 | // return new Response 136 | // { 137 | // Code = 404, 138 | // Message = "Not found", 139 | // Value = null 140 | // }; 141 | // } 142 | 143 | // var mappedUser = this.mapper.Map(users); 144 | 145 | // return new Response 146 | // { 147 | // Code = 200, 148 | // Message = "Succes", 149 | // Value = mappedUser 150 | // }; 151 | // } 152 | 153 | // public async ValueTask> ModifyUserAsync(int id, OrganisationCDto OrganisationCDto) 154 | // { 155 | // var user = await this.OrganisationRepostory.SelectOrganisationAsync(id); 156 | // if (user is null) 157 | // return new Response 158 | // { 159 | // Code = 404, 160 | // Message = "Not found", 161 | // Value = null 162 | // }; 163 | 164 | // var updatedUser = await this.OrganisationRepostory.UpdateOrganisationAsync(user); 165 | // var mappedUsers = this.mapper.Map(updatedUser); 166 | // return new Response 167 | // { 168 | // Code = 200, 169 | // Message = "Success", 170 | // Value = mappedUsers 171 | // }; 172 | // } 173 | // } 174 | 175 | // internal interface IOrganisationService 176 | // { 177 | // } 178 | //} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # Tye 66 | .tye/ 67 | 68 | # ASP.NET Scaffolding 69 | ScaffoldingReadMe.txt 70 | 71 | # StyleCop 72 | StyleCopReport.xml 73 | 74 | # Files built by Visual Studio 75 | *_i.c 76 | *_p.c 77 | *_h.h 78 | *.ilk 79 | *.meta 80 | *.obj 81 | *.iobj 82 | *.pch 83 | *.pdb 84 | *.ipdb 85 | *.pgc 86 | *.pgd 87 | *.rsp 88 | *.sbr 89 | *.tlb 90 | *.tli 91 | *.tlh 92 | *.tmp 93 | *.tmp_proj 94 | *_wpftmp.csproj 95 | *.log 96 | *.tlog 97 | *.vspscc 98 | *.vssscc 99 | .builds 100 | *.pidb 101 | *.svclog 102 | *.scc 103 | 104 | # Chutzpah Test files 105 | _Chutzpah* 106 | 107 | # Visual C++ cache files 108 | ipch/ 109 | *.aps 110 | *.ncb 111 | *.opendb 112 | *.opensdf 113 | *.sdf 114 | *.cachefile 115 | *.VC.db 116 | *.VC.VC.opendb 117 | 118 | # Visual Studio profiler 119 | *.psess 120 | *.vsp 121 | *.vspx 122 | *.sap 123 | 124 | # Visual Studio Trace Files 125 | *.e2e 126 | 127 | # TFS 2012 Local Workspace 128 | $tf/ 129 | 130 | # Guidance Automation Toolkit 131 | *.gpState 132 | 133 | # ReSharper is a .NET coding add-in 134 | _ReSharper*/ 135 | *.[Rr]e[Ss]harper 136 | *.DotSettings.user 137 | 138 | # TeamCity is a build add-in 139 | _TeamCity* 140 | 141 | # DotCover is a Code Coverage Tool 142 | *.dotCover 143 | 144 | # AxoCover is a Code Coverage Tool 145 | .axoCover/* 146 | !.axoCover/settings.json 147 | 148 | # Coverlet is a free, cross platform Code Coverage Tool 149 | coverage*.json 150 | coverage*.xml 151 | coverage*.info 152 | 153 | # Visual Studio code coverage results 154 | *.coverage 155 | *.coveragexml 156 | 157 | # NCrunch 158 | _NCrunch_* 159 | .*crunch*.local.xml 160 | nCrunchTemp_* 161 | 162 | # MightyMoose 163 | *.mm.* 164 | AutoTest.Net/ 165 | 166 | # Web workbench (sass) 167 | .sass-cache/ 168 | 169 | # Installshield output folder 170 | [Ee]xpress/ 171 | 172 | # DocProject is a documentation generator add-in 173 | DocProject/buildhelp/ 174 | DocProject/Help/*.HxT 175 | DocProject/Help/*.HxC 176 | DocProject/Help/*.hhc 177 | DocProject/Help/*.hhk 178 | DocProject/Help/*.hhp 179 | DocProject/Help/Html2 180 | DocProject/Help/html 181 | 182 | # Click-Once directory 183 | publish/ 184 | 185 | # Publish Web Output 186 | *.[Pp]ublish.xml 187 | *.azurePubxml 188 | # Note: Comment the next line if you want to checkin your web deploy settings, 189 | # but database connection strings (with potential passwords) will be unencrypted 190 | *.pubxml 191 | *.publishproj 192 | 193 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 194 | # checkin your Azure Web App publish settings, but sensitive information contained 195 | # in these scripts will be unencrypted 196 | PublishScripts/ 197 | 198 | # NuGet Packages 199 | *.nupkg 200 | # NuGet Symbol Packages 201 | *.snupkg 202 | # The packages folder can be ignored because of Package Restore 203 | **/[Pp]ackages/* 204 | # except build/, which is used as an MSBuild target. 205 | !**/[Pp]ackages/build/ 206 | # Uncomment if necessary however generally it will be regenerated when needed 207 | #!**/[Pp]ackages/repositories.config 208 | # NuGet v3's project.json files produces more ignorable files 209 | *.nuget.props 210 | *.nuget.targets 211 | 212 | # Microsoft Azure Build Output 213 | csx/ 214 | *.build.csdef 215 | 216 | # Microsoft Azure Emulator 217 | ecf/ 218 | rcf/ 219 | 220 | # Windows Store app package directories and files 221 | AppPackages/ 222 | BundleArtifacts/ 223 | Package.StoreAssociation.xml 224 | _pkginfo.txt 225 | *.appx 226 | *.appxbundle 227 | *.appxupload 228 | 229 | # Visual Studio cache files 230 | # files ending in .cache can be ignored 231 | *.[Cc]ache 232 | # but keep track of directories ending in .cache 233 | !?*.[Cc]ache/ 234 | 235 | # Others 236 | ClientBin/ 237 | ~$* 238 | *~ 239 | *.dbmdl 240 | *.dbproj.schemaview 241 | *.jfm 242 | *.pfx 243 | *.publishsettings 244 | orleans.codegen.cs 245 | 246 | # Including strong name files can present a security risk 247 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 248 | #*.snk 249 | 250 | # Since there are multiple workflows, uncomment next line to ignore bower_components 251 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 252 | #bower_components/ 253 | 254 | # RIA/Silverlight projects 255 | Generated_Code/ 256 | 257 | # Backup & report files from converting an old project file 258 | # to a newer Visual Studio version. Backup files are not needed, 259 | # because we have git ;-) 260 | _UpgradeReport_Files/ 261 | Backup*/ 262 | UpgradeLog*.XML 263 | UpgradeLog*.htm 264 | ServiceFabricBackup/ 265 | *.rptproj.bak 266 | 267 | # SQL Server files 268 | *.mdf 269 | *.ldf 270 | *.ndf 271 | 272 | # Business Intelligence projects 273 | *.rdl.data 274 | *.bim.layout 275 | *.bim_*.settings 276 | *.rptproj.rsuser 277 | *- [Bb]ackup.rdl 278 | *- [Bb]ackup ([0-9]).rdl 279 | *- [Bb]ackup ([0-9][0-9]).rdl 280 | 281 | # Microsoft Fakes 282 | FakesAssemblies/ 283 | 284 | # GhostDoc plugin setting file 285 | *.GhostDoc.xml 286 | 287 | # Node.js Tools for Visual Studio 288 | .ntvs_analysis.dat 289 | node_modules/ 290 | 291 | # Visual Studio 6 build log 292 | *.plg 293 | 294 | # Visual Studio 6 workspace options file 295 | *.opt 296 | 297 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 298 | *.vbw 299 | 300 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 301 | *.vbp 302 | 303 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 304 | *.dsw 305 | *.dsp 306 | 307 | # Visual Studio 6 technical files 308 | *.ncb 309 | *.aps 310 | 311 | # Visual Studio LightSwitch build output 312 | **/*.HTMLClient/GeneratedArtifacts 313 | **/*.DesktopClient/GeneratedArtifacts 314 | **/*.DesktopClient/ModelManifest.xml 315 | **/*.Server/GeneratedArtifacts 316 | **/*.Server/ModelManifest.xml 317 | _Pvt_Extensions 318 | 319 | # Paket dependency manager 320 | .paket/paket.exe 321 | paket-files/ 322 | 323 | # FAKE - F# Make 324 | .fake/ 325 | 326 | # CodeRush personal settings 327 | .cr/personal 328 | 329 | # Python Tools for Visual Studio (PTVS) 330 | __pycache__/ 331 | *.pyc 332 | 333 | # Cake - Uncomment if you are using it 334 | # tools/** 335 | # !tools/packages.config 336 | 337 | # Tabs Studio 338 | *.tss 339 | 340 | # Telerik's JustMock configuration file 341 | *.jmconfig 342 | 343 | # BizTalk build output 344 | *.btp.cs 345 | *.btm.cs 346 | *.odx.cs 347 | *.xsd.cs 348 | 349 | # OpenCover UI analysis results 350 | OpenCover/ 351 | 352 | # Azure Stream Analytics local run output 353 | ASALocalRun/ 354 | 355 | # MSBuild Binary and Structured Log 356 | *.binlog 357 | 358 | # NVidia Nsight GPU debugger configuration file 359 | *.nvuser 360 | 361 | # MFractors (Xamarin productivity tool) working folder 362 | .mfractor/ 363 | 364 | # Local History for Visual Studio 365 | .localhistory/ 366 | 367 | # Visual Studio History (VSHistory) files 368 | .vshistory/ 369 | 370 | # BeatPulse healthcheck temp database 371 | healthchecksdb 372 | 373 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 374 | MigrationBackup/ 375 | 376 | # Ionide (cross platform F# VS Code tools) working folder 377 | .ionide/ 378 | 379 | # Fody - auto-generated XML schema 380 | FodyWeavers.xsd 381 | 382 | # VS Code files for those working on multiple tools 383 | .vscode/* 384 | !.vscode/settings.json 385 | !.vscode/tasks.json 386 | !.vscode/launch.json 387 | !.vscode/extensions.json 388 | *.code-workspace 389 | 390 | # Local History for Visual Studio Code 391 | .history/ 392 | 393 | # Windows Installer files from build outputs 394 | *.cab 395 | *.msi 396 | *.msix 397 | *.msm 398 | *.msp 399 | 400 | # JetBrains Rider 401 | *.sln.iml 402 | 403 | ## 404 | ## Visual studio for Mac 405 | ## 406 | 407 | 408 | # globs 409 | Makefile.in 410 | *.userprefs 411 | *.usertasks 412 | config.make 413 | config.status 414 | aclocal.m4 415 | install-sh 416 | autom4te.cache/ 417 | *.tar.gz 418 | tarballs/ 419 | test-results/ 420 | 421 | # Mac bundle stuff 422 | *.dmg 423 | *.app 424 | 425 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore 426 | # General 427 | .DS_Store 428 | .AppleDouble 429 | .LSOverride 430 | 431 | # Icon must end with two \r 432 | Icon 433 | 434 | 435 | # Thumbnails 436 | ._* 437 | 438 | # Files that might appear in the root of a volume 439 | .DocumentRevisions-V100 440 | .fseventsd 441 | .Spotlight-V100 442 | .TemporaryItems 443 | .Trashes 444 | .VolumeIcon.icns 445 | .com.apple.timemachine.donotpresent 446 | 447 | # Directories potentially created on remote AFP share 448 | .AppleDB 449 | .AppleDesktop 450 | Network Trash Folder 451 | Temporary Items 452 | .apdisk 453 | 454 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 455 | # Windows thumbnail cache files 456 | Thumbs.db 457 | ehthumbs.db 458 | ehthumbs_vista.db 459 | 460 | # Dump file 461 | *.stackdump 462 | 463 | # Folder config file 464 | [Dd]esktop.ini 465 | 466 | # Recycle Bin used on file shares 467 | $RECYCLE.BIN/ 468 | 469 | # Windows Installer files 470 | *.cab 471 | *.msi 472 | *.msix 473 | *.msm 474 | *.msp 475 | 476 | # Windows shortcuts 477 | *.lnk 478 | -------------------------------------------------------------------------------- /Data/Migrations/20230317203758_Initial.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; 4 | 5 | #nullable disable 6 | 7 | namespace Data.Migrations 8 | { 9 | /// 10 | public partial class Initial : Migration 11 | { 12 | /// 13 | protected override void Up(MigrationBuilder migrationBuilder) 14 | { 15 | migrationBuilder.CreateTable( 16 | name: "Languages", 17 | columns: table => new 18 | { 19 | Id = table.Column(type: "integer", nullable: false) 20 | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), 21 | Name = table.Column(type: "text", nullable: true), 22 | RepositoryId = table.Column(type: "bigint", nullable: false) 23 | }, 24 | constraints: table => 25 | { 26 | table.PrimaryKey("PK_Languages", x => x.Id); 27 | }); 28 | 29 | migrationBuilder.CreateTable( 30 | name: "Organizations", 31 | columns: table => new 32 | { 33 | Id = table.Column(type: "bigint", nullable: false) 34 | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), 35 | Name = table.Column(type: "text", nullable: true), 36 | Description = table.Column(type: "text", nullable: true), 37 | CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), 38 | UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) 39 | }, 40 | constraints: table => 41 | { 42 | table.PrimaryKey("PK_Organizations", x => x.Id); 43 | }); 44 | 45 | migrationBuilder.CreateTable( 46 | name: "Users", 47 | columns: table => new 48 | { 49 | Id = table.Column(type: "bigint", nullable: false) 50 | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), 51 | FirstName = table.Column(type: "text", nullable: true), 52 | LastName = table.Column(type: "text", nullable: true), 53 | Description = table.Column(type: "text", nullable: true), 54 | Link = table.Column(type: "text", nullable: true), 55 | Email = table.Column(type: "text", nullable: true), 56 | Password = table.Column(type: "text", nullable: false), 57 | CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), 58 | UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) 59 | }, 60 | constraints: table => 61 | { 62 | table.PrimaryKey("PK_Users", x => x.Id); 63 | }); 64 | 65 | migrationBuilder.CreateTable( 66 | name: "Followeres", 67 | columns: table => new 68 | { 69 | Id = table.Column(type: "bigint", nullable: false) 70 | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), 71 | UserId = table.Column(type: "bigint", nullable: false), 72 | CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), 73 | UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) 74 | }, 75 | constraints: table => 76 | { 77 | table.PrimaryKey("PK_Followeres", x => x.Id); 78 | table.ForeignKey( 79 | name: "FK_Followeres_Users_UserId", 80 | column: x => x.UserId, 81 | principalTable: "Users", 82 | principalColumn: "Id", 83 | onDelete: ReferentialAction.Cascade); 84 | }); 85 | 86 | migrationBuilder.CreateTable( 87 | name: "Followings", 88 | columns: table => new 89 | { 90 | Id = table.Column(type: "bigint", nullable: false) 91 | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), 92 | UserId = table.Column(type: "bigint", nullable: false), 93 | CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), 94 | UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) 95 | }, 96 | constraints: table => 97 | { 98 | table.PrimaryKey("PK_Followings", x => x.Id); 99 | table.ForeignKey( 100 | name: "FK_Followings_Users_UserId", 101 | column: x => x.UserId, 102 | principalTable: "Users", 103 | principalColumn: "Id", 104 | onDelete: ReferentialAction.Cascade); 105 | }); 106 | 107 | migrationBuilder.CreateTable( 108 | name: "OrganizationMember", 109 | columns: table => new 110 | { 111 | Id = table.Column(type: "bigint", nullable: false) 112 | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), 113 | UserId = table.Column(type: "bigint", nullable: false), 114 | OrganizationId = table.Column(type: "bigint", nullable: false), 115 | CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), 116 | UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) 117 | }, 118 | constraints: table => 119 | { 120 | table.PrimaryKey("PK_OrganizationMember", x => x.Id); 121 | table.ForeignKey( 122 | name: "FK_OrganizationMember_Organizations_OrganizationId", 123 | column: x => x.OrganizationId, 124 | principalTable: "Organizations", 125 | principalColumn: "Id", 126 | onDelete: ReferentialAction.Cascade); 127 | table.ForeignKey( 128 | name: "FK_OrganizationMember_Users_UserId", 129 | column: x => x.UserId, 130 | principalTable: "Users", 131 | principalColumn: "Id", 132 | onDelete: ReferentialAction.Cascade); 133 | }); 134 | 135 | migrationBuilder.CreateTable( 136 | name: "Repositories", 137 | columns: table => new 138 | { 139 | Id = table.Column(type: "bigint", nullable: false) 140 | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), 141 | Name = table.Column(type: "text", nullable: true), 142 | Description = table.Column(type: "text", nullable: true), 143 | RepositoryType = table.Column(type: "integer", nullable: false), 144 | StarsCount = table.Column(type: "integer", nullable: false), 145 | UserId = table.Column(type: "bigint", nullable: false), 146 | OrganizationId = table.Column(type: "bigint", nullable: false), 147 | CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), 148 | UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) 149 | }, 150 | constraints: table => 151 | { 152 | table.PrimaryKey("PK_Repositories", x => x.Id); 153 | table.ForeignKey( 154 | name: "FK_Repositories_Organizations_OrganizationId", 155 | column: x => x.OrganizationId, 156 | principalTable: "Organizations", 157 | principalColumn: "Id", 158 | onDelete: ReferentialAction.Cascade); 159 | table.ForeignKey( 160 | name: "FK_Repositories_Users_UserId", 161 | column: x => x.UserId, 162 | principalTable: "Users", 163 | principalColumn: "Id", 164 | onDelete: ReferentialAction.Cascade); 165 | }); 166 | 167 | migrationBuilder.CreateTable( 168 | name: "Stars", 169 | columns: table => new 170 | { 171 | Id = table.Column(type: "bigint", nullable: false) 172 | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), 173 | UserId = table.Column(type: "bigint", nullable: false), 174 | RepositoryId = table.Column(type: "bigint", nullable: false), 175 | CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), 176 | UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) 177 | }, 178 | constraints: table => 179 | { 180 | table.PrimaryKey("PK_Stars", x => x.Id); 181 | table.ForeignKey( 182 | name: "FK_Stars_Repositories_RepositoryId", 183 | column: x => x.RepositoryId, 184 | principalTable: "Repositories", 185 | principalColumn: "Id", 186 | onDelete: ReferentialAction.Cascade); 187 | table.ForeignKey( 188 | name: "FK_Stars_Users_UserId", 189 | column: x => x.UserId, 190 | principalTable: "Users", 191 | principalColumn: "Id", 192 | onDelete: ReferentialAction.Cascade); 193 | }); 194 | 195 | migrationBuilder.CreateIndex( 196 | name: "IX_Followeres_UserId", 197 | table: "Followeres", 198 | column: "UserId"); 199 | 200 | migrationBuilder.CreateIndex( 201 | name: "IX_Followings_UserId", 202 | table: "Followings", 203 | column: "UserId"); 204 | 205 | migrationBuilder.CreateIndex( 206 | name: "IX_OrganizationMember_OrganizationId", 207 | table: "OrganizationMember", 208 | column: "OrganizationId"); 209 | 210 | migrationBuilder.CreateIndex( 211 | name: "IX_OrganizationMember_UserId", 212 | table: "OrganizationMember", 213 | column: "UserId"); 214 | 215 | migrationBuilder.CreateIndex( 216 | name: "IX_Repositories_OrganizationId", 217 | table: "Repositories", 218 | column: "OrganizationId"); 219 | 220 | migrationBuilder.CreateIndex( 221 | name: "IX_Repositories_UserId", 222 | table: "Repositories", 223 | column: "UserId"); 224 | 225 | migrationBuilder.CreateIndex( 226 | name: "IX_Stars_RepositoryId", 227 | table: "Stars", 228 | column: "RepositoryId"); 229 | 230 | migrationBuilder.CreateIndex( 231 | name: "IX_Stars_UserId", 232 | table: "Stars", 233 | column: "UserId"); 234 | } 235 | 236 | /// 237 | protected override void Down(MigrationBuilder migrationBuilder) 238 | { 239 | migrationBuilder.DropTable( 240 | name: "Followeres"); 241 | 242 | migrationBuilder.DropTable( 243 | name: "Followings"); 244 | 245 | migrationBuilder.DropTable( 246 | name: "Languages"); 247 | 248 | migrationBuilder.DropTable( 249 | name: "OrganizationMember"); 250 | 251 | migrationBuilder.DropTable( 252 | name: "Stars"); 253 | 254 | migrationBuilder.DropTable( 255 | name: "Repositories"); 256 | 257 | migrationBuilder.DropTable( 258 | name: "Organizations"); 259 | 260 | migrationBuilder.DropTable( 261 | name: "Users"); 262 | } 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /Data/Migrations/AppDbContextModelSnapshot.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Data.Context; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 7 | using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; 8 | 9 | #nullable disable 10 | 11 | namespace Data.Migrations 12 | { 13 | [DbContext(typeof(AppDbContext))] 14 | partial class AppDbContextModelSnapshot : ModelSnapshot 15 | { 16 | protected override void BuildModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "7.0.4") 21 | .HasAnnotation("Relational:MaxIdentifierLength", 63); 22 | 23 | NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); 24 | 25 | modelBuilder.Entity("Domain.Entities.Follower", b => 26 | { 27 | b.Property("Id") 28 | .ValueGeneratedOnAdd() 29 | .HasColumnType("bigint"); 30 | 31 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 32 | 33 | b.Property("CreatedAt") 34 | .HasColumnType("timestamp with time zone"); 35 | 36 | b.Property("UpdatedAt") 37 | .HasColumnType("timestamp with time zone"); 38 | 39 | b.Property("UserId") 40 | .HasColumnType("bigint"); 41 | 42 | b.HasKey("Id"); 43 | 44 | b.HasIndex("UserId"); 45 | 46 | b.ToTable("Followeres"); 47 | }); 48 | 49 | modelBuilder.Entity("Domain.Entities.Following", b => 50 | { 51 | b.Property("Id") 52 | .ValueGeneratedOnAdd() 53 | .HasColumnType("bigint"); 54 | 55 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 56 | 57 | b.Property("CreatedAt") 58 | .HasColumnType("timestamp with time zone"); 59 | 60 | b.Property("UpdatedAt") 61 | .HasColumnType("timestamp with time zone"); 62 | 63 | b.Property("UserId") 64 | .HasColumnType("bigint"); 65 | 66 | b.HasKey("Id"); 67 | 68 | b.HasIndex("UserId"); 69 | 70 | b.ToTable("Followings"); 71 | }); 72 | 73 | modelBuilder.Entity("Domain.Entities.Languages", b => 74 | { 75 | b.Property("Id") 76 | .ValueGeneratedOnAdd() 77 | .HasColumnType("integer"); 78 | 79 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 80 | 81 | b.Property("Name") 82 | .HasColumnType("text"); 83 | 84 | b.Property("RepositoryId") 85 | .HasColumnType("bigint"); 86 | 87 | b.HasKey("Id"); 88 | 89 | b.ToTable("Languages"); 90 | }); 91 | 92 | modelBuilder.Entity("Domain.Entities.Organization", b => 93 | { 94 | b.Property("Id") 95 | .ValueGeneratedOnAdd() 96 | .HasColumnType("bigint"); 97 | 98 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 99 | 100 | b.Property("CreatedAt") 101 | .HasColumnType("timestamp with time zone"); 102 | 103 | b.Property("Description") 104 | .HasColumnType("text"); 105 | 106 | b.Property("Name") 107 | .HasColumnType("text"); 108 | 109 | b.Property("UpdatedAt") 110 | .HasColumnType("timestamp with time zone"); 111 | 112 | b.HasKey("Id"); 113 | 114 | b.ToTable("Organizations"); 115 | }); 116 | 117 | modelBuilder.Entity("Domain.Entities.OrganizationMember", b => 118 | { 119 | b.Property("Id") 120 | .ValueGeneratedOnAdd() 121 | .HasColumnType("bigint"); 122 | 123 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 124 | 125 | b.Property("CreatedAt") 126 | .HasColumnType("timestamp with time zone"); 127 | 128 | b.Property("OrganizationId") 129 | .HasColumnType("bigint"); 130 | 131 | b.Property("UpdatedAt") 132 | .HasColumnType("timestamp with time zone"); 133 | 134 | b.Property("UserId") 135 | .HasColumnType("bigint"); 136 | 137 | b.HasKey("Id"); 138 | 139 | b.HasIndex("OrganizationId"); 140 | 141 | b.HasIndex("UserId"); 142 | 143 | b.ToTable("OrganizationMember"); 144 | }); 145 | 146 | modelBuilder.Entity("Domain.Entities.Repository", b => 147 | { 148 | b.Property("Id") 149 | .ValueGeneratedOnAdd() 150 | .HasColumnType("bigint"); 151 | 152 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 153 | 154 | b.Property("CreatedAt") 155 | .HasColumnType("timestamp with time zone"); 156 | 157 | b.Property("Description") 158 | .HasColumnType("text"); 159 | 160 | b.Property("Name") 161 | .HasColumnType("text"); 162 | 163 | b.Property("OrganizationId") 164 | .HasColumnType("bigint"); 165 | 166 | b.Property("RepositoryType") 167 | .HasColumnType("integer"); 168 | 169 | b.Property("StarsCount") 170 | .HasColumnType("integer"); 171 | 172 | b.Property("UpdatedAt") 173 | .HasColumnType("timestamp with time zone"); 174 | 175 | b.Property("UserId") 176 | .HasColumnType("bigint"); 177 | 178 | b.HasKey("Id"); 179 | 180 | b.HasIndex("OrganizationId"); 181 | 182 | b.HasIndex("UserId"); 183 | 184 | b.ToTable("Repositories"); 185 | }); 186 | 187 | modelBuilder.Entity("Domain.Entities.Star", b => 188 | { 189 | b.Property("Id") 190 | .ValueGeneratedOnAdd() 191 | .HasColumnType("bigint"); 192 | 193 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 194 | 195 | b.Property("CreatedAt") 196 | .HasColumnType("timestamp with time zone"); 197 | 198 | b.Property("RepositoryId") 199 | .HasColumnType("bigint"); 200 | 201 | b.Property("UpdatedAt") 202 | .HasColumnType("timestamp with time zone"); 203 | 204 | b.Property("UserId") 205 | .HasColumnType("bigint"); 206 | 207 | b.HasKey("Id"); 208 | 209 | b.HasIndex("RepositoryId"); 210 | 211 | b.HasIndex("UserId"); 212 | 213 | b.ToTable("Stars"); 214 | }); 215 | 216 | modelBuilder.Entity("Domain.Entities.User", b => 217 | { 218 | b.Property("Id") 219 | .ValueGeneratedOnAdd() 220 | .HasColumnType("bigint"); 221 | 222 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 223 | 224 | b.Property("CreatedAt") 225 | .HasColumnType("timestamp with time zone"); 226 | 227 | b.Property("Description") 228 | .HasColumnType("text"); 229 | 230 | b.Property("Email") 231 | .HasColumnType("text"); 232 | 233 | b.Property("FirstName") 234 | .HasColumnType("text"); 235 | 236 | b.Property("LastName") 237 | .HasColumnType("text"); 238 | 239 | b.Property("Link") 240 | .HasColumnType("text"); 241 | 242 | b.Property("Password") 243 | .IsRequired() 244 | .HasColumnType("text"); 245 | 246 | b.Property("UpdatedAt") 247 | .HasColumnType("timestamp with time zone"); 248 | 249 | b.HasKey("Id"); 250 | 251 | b.ToTable("Users"); 252 | }); 253 | 254 | modelBuilder.Entity("Domain.Entities.Follower", b => 255 | { 256 | b.HasOne("Domain.Entities.User", "User") 257 | .WithMany() 258 | .HasForeignKey("UserId") 259 | .OnDelete(DeleteBehavior.Cascade) 260 | .IsRequired(); 261 | 262 | b.Navigation("User"); 263 | }); 264 | 265 | modelBuilder.Entity("Domain.Entities.Following", b => 266 | { 267 | b.HasOne("Domain.Entities.User", "User") 268 | .WithMany() 269 | .HasForeignKey("UserId") 270 | .OnDelete(DeleteBehavior.Cascade) 271 | .IsRequired(); 272 | 273 | b.Navigation("User"); 274 | }); 275 | 276 | modelBuilder.Entity("Domain.Entities.OrganizationMember", b => 277 | { 278 | b.HasOne("Domain.Entities.Organization", "Organization") 279 | .WithMany("organizationMembers") 280 | .HasForeignKey("OrganizationId") 281 | .OnDelete(DeleteBehavior.Cascade) 282 | .IsRequired(); 283 | 284 | b.HasOne("Domain.Entities.User", "User") 285 | .WithMany() 286 | .HasForeignKey("UserId") 287 | .OnDelete(DeleteBehavior.Cascade) 288 | .IsRequired(); 289 | 290 | b.Navigation("Organization"); 291 | 292 | b.Navigation("User"); 293 | }); 294 | 295 | modelBuilder.Entity("Domain.Entities.Repository", b => 296 | { 297 | b.HasOne("Domain.Entities.Organization", "Organization") 298 | .WithMany("Repositories") 299 | .HasForeignKey("OrganizationId") 300 | .OnDelete(DeleteBehavior.Cascade) 301 | .IsRequired(); 302 | 303 | b.HasOne("Domain.Entities.User", "User") 304 | .WithMany() 305 | .HasForeignKey("UserId") 306 | .OnDelete(DeleteBehavior.Cascade) 307 | .IsRequired(); 308 | 309 | b.Navigation("Organization"); 310 | 311 | b.Navigation("User"); 312 | }); 313 | 314 | modelBuilder.Entity("Domain.Entities.Star", b => 315 | { 316 | b.HasOne("Domain.Entities.Repository", "Repository") 317 | .WithMany("Stars") 318 | .HasForeignKey("RepositoryId") 319 | .OnDelete(DeleteBehavior.Cascade) 320 | .IsRequired(); 321 | 322 | b.HasOne("Domain.Entities.User", "User") 323 | .WithMany() 324 | .HasForeignKey("UserId") 325 | .OnDelete(DeleteBehavior.Cascade) 326 | .IsRequired(); 327 | 328 | b.Navigation("Repository"); 329 | 330 | b.Navigation("User"); 331 | }); 332 | 333 | modelBuilder.Entity("Domain.Entities.Organization", b => 334 | { 335 | b.Navigation("Repositories"); 336 | 337 | b.Navigation("organizationMembers"); 338 | }); 339 | 340 | modelBuilder.Entity("Domain.Entities.Repository", b => 341 | { 342 | b.Navigation("Stars"); 343 | }); 344 | #pragma warning restore 612, 618 345 | } 346 | } 347 | } 348 | -------------------------------------------------------------------------------- /Data/Migrations/20230317203758_Initial.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Data.Context; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; 9 | 10 | #nullable disable 11 | 12 | namespace Data.Migrations 13 | { 14 | [DbContext(typeof(AppDbContext))] 15 | [Migration("20230317203758_Initial")] 16 | partial class Initial 17 | { 18 | /// 19 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 20 | { 21 | #pragma warning disable 612, 618 22 | modelBuilder 23 | .HasAnnotation("ProductVersion", "7.0.4") 24 | .HasAnnotation("Relational:MaxIdentifierLength", 63); 25 | 26 | NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); 27 | 28 | modelBuilder.Entity("Domain.Entities.Follower", b => 29 | { 30 | b.Property("Id") 31 | .ValueGeneratedOnAdd() 32 | .HasColumnType("bigint"); 33 | 34 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 35 | 36 | b.Property("CreatedAt") 37 | .HasColumnType("timestamp with time zone"); 38 | 39 | b.Property("UpdatedAt") 40 | .HasColumnType("timestamp with time zone"); 41 | 42 | b.Property("UserId") 43 | .HasColumnType("bigint"); 44 | 45 | b.HasKey("Id"); 46 | 47 | b.HasIndex("UserId"); 48 | 49 | b.ToTable("Followeres"); 50 | }); 51 | 52 | modelBuilder.Entity("Domain.Entities.Following", b => 53 | { 54 | b.Property("Id") 55 | .ValueGeneratedOnAdd() 56 | .HasColumnType("bigint"); 57 | 58 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 59 | 60 | b.Property("CreatedAt") 61 | .HasColumnType("timestamp with time zone"); 62 | 63 | b.Property("UpdatedAt") 64 | .HasColumnType("timestamp with time zone"); 65 | 66 | b.Property("UserId") 67 | .HasColumnType("bigint"); 68 | 69 | b.HasKey("Id"); 70 | 71 | b.HasIndex("UserId"); 72 | 73 | b.ToTable("Followings"); 74 | }); 75 | 76 | modelBuilder.Entity("Domain.Entities.Languages", b => 77 | { 78 | b.Property("Id") 79 | .ValueGeneratedOnAdd() 80 | .HasColumnType("integer"); 81 | 82 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 83 | 84 | b.Property("Name") 85 | .HasColumnType("text"); 86 | 87 | b.Property("RepositoryId") 88 | .HasColumnType("bigint"); 89 | 90 | b.HasKey("Id"); 91 | 92 | b.ToTable("Languages"); 93 | }); 94 | 95 | modelBuilder.Entity("Domain.Entities.Organization", b => 96 | { 97 | b.Property("Id") 98 | .ValueGeneratedOnAdd() 99 | .HasColumnType("bigint"); 100 | 101 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 102 | 103 | b.Property("CreatedAt") 104 | .HasColumnType("timestamp with time zone"); 105 | 106 | b.Property("Description") 107 | .HasColumnType("text"); 108 | 109 | b.Property("Name") 110 | .HasColumnType("text"); 111 | 112 | b.Property("UpdatedAt") 113 | .HasColumnType("timestamp with time zone"); 114 | 115 | b.HasKey("Id"); 116 | 117 | b.ToTable("Organizations"); 118 | }); 119 | 120 | modelBuilder.Entity("Domain.Entities.OrganizationMember", b => 121 | { 122 | b.Property("Id") 123 | .ValueGeneratedOnAdd() 124 | .HasColumnType("bigint"); 125 | 126 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 127 | 128 | b.Property("CreatedAt") 129 | .HasColumnType("timestamp with time zone"); 130 | 131 | b.Property("OrganizationId") 132 | .HasColumnType("bigint"); 133 | 134 | b.Property("UpdatedAt") 135 | .HasColumnType("timestamp with time zone"); 136 | 137 | b.Property("UserId") 138 | .HasColumnType("bigint"); 139 | 140 | b.HasKey("Id"); 141 | 142 | b.HasIndex("OrganizationId"); 143 | 144 | b.HasIndex("UserId"); 145 | 146 | b.ToTable("OrganizationMember"); 147 | }); 148 | 149 | modelBuilder.Entity("Domain.Entities.Repository", b => 150 | { 151 | b.Property("Id") 152 | .ValueGeneratedOnAdd() 153 | .HasColumnType("bigint"); 154 | 155 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 156 | 157 | b.Property("CreatedAt") 158 | .HasColumnType("timestamp with time zone"); 159 | 160 | b.Property("Description") 161 | .HasColumnType("text"); 162 | 163 | b.Property("Name") 164 | .HasColumnType("text"); 165 | 166 | b.Property("OrganizationId") 167 | .HasColumnType("bigint"); 168 | 169 | b.Property("RepositoryType") 170 | .HasColumnType("integer"); 171 | 172 | b.Property("StarsCount") 173 | .HasColumnType("integer"); 174 | 175 | b.Property("UpdatedAt") 176 | .HasColumnType("timestamp with time zone"); 177 | 178 | b.Property("UserId") 179 | .HasColumnType("bigint"); 180 | 181 | b.HasKey("Id"); 182 | 183 | b.HasIndex("OrganizationId"); 184 | 185 | b.HasIndex("UserId"); 186 | 187 | b.ToTable("Repositories"); 188 | }); 189 | 190 | modelBuilder.Entity("Domain.Entities.Star", b => 191 | { 192 | b.Property("Id") 193 | .ValueGeneratedOnAdd() 194 | .HasColumnType("bigint"); 195 | 196 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 197 | 198 | b.Property("CreatedAt") 199 | .HasColumnType("timestamp with time zone"); 200 | 201 | b.Property("RepositoryId") 202 | .HasColumnType("bigint"); 203 | 204 | b.Property("UpdatedAt") 205 | .HasColumnType("timestamp with time zone"); 206 | 207 | b.Property("UserId") 208 | .HasColumnType("bigint"); 209 | 210 | b.HasKey("Id"); 211 | 212 | b.HasIndex("RepositoryId"); 213 | 214 | b.HasIndex("UserId"); 215 | 216 | b.ToTable("Stars"); 217 | }); 218 | 219 | modelBuilder.Entity("Domain.Entities.User", b => 220 | { 221 | b.Property("Id") 222 | .ValueGeneratedOnAdd() 223 | .HasColumnType("bigint"); 224 | 225 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 226 | 227 | b.Property("CreatedAt") 228 | .HasColumnType("timestamp with time zone"); 229 | 230 | b.Property("Description") 231 | .HasColumnType("text"); 232 | 233 | b.Property("Email") 234 | .HasColumnType("text"); 235 | 236 | b.Property("FirstName") 237 | .HasColumnType("text"); 238 | 239 | b.Property("LastName") 240 | .HasColumnType("text"); 241 | 242 | b.Property("Link") 243 | .HasColumnType("text"); 244 | 245 | b.Property("Password") 246 | .IsRequired() 247 | .HasColumnType("text"); 248 | 249 | b.Property("UpdatedAt") 250 | .HasColumnType("timestamp with time zone"); 251 | 252 | b.HasKey("Id"); 253 | 254 | b.ToTable("Users"); 255 | }); 256 | 257 | modelBuilder.Entity("Domain.Entities.Follower", b => 258 | { 259 | b.HasOne("Domain.Entities.User", "User") 260 | .WithMany() 261 | .HasForeignKey("UserId") 262 | .OnDelete(DeleteBehavior.Cascade) 263 | .IsRequired(); 264 | 265 | b.Navigation("User"); 266 | }); 267 | 268 | modelBuilder.Entity("Domain.Entities.Following", b => 269 | { 270 | b.HasOne("Domain.Entities.User", "User") 271 | .WithMany() 272 | .HasForeignKey("UserId") 273 | .OnDelete(DeleteBehavior.Cascade) 274 | .IsRequired(); 275 | 276 | b.Navigation("User"); 277 | }); 278 | 279 | modelBuilder.Entity("Domain.Entities.OrganizationMember", b => 280 | { 281 | b.HasOne("Domain.Entities.Organization", "Organization") 282 | .WithMany("organizationMembers") 283 | .HasForeignKey("OrganizationId") 284 | .OnDelete(DeleteBehavior.Cascade) 285 | .IsRequired(); 286 | 287 | b.HasOne("Domain.Entities.User", "User") 288 | .WithMany() 289 | .HasForeignKey("UserId") 290 | .OnDelete(DeleteBehavior.Cascade) 291 | .IsRequired(); 292 | 293 | b.Navigation("Organization"); 294 | 295 | b.Navigation("User"); 296 | }); 297 | 298 | modelBuilder.Entity("Domain.Entities.Repository", b => 299 | { 300 | b.HasOne("Domain.Entities.Organization", "Organization") 301 | .WithMany("Repositories") 302 | .HasForeignKey("OrganizationId") 303 | .OnDelete(DeleteBehavior.Cascade) 304 | .IsRequired(); 305 | 306 | b.HasOne("Domain.Entities.User", "User") 307 | .WithMany() 308 | .HasForeignKey("UserId") 309 | .OnDelete(DeleteBehavior.Cascade) 310 | .IsRequired(); 311 | 312 | b.Navigation("Organization"); 313 | 314 | b.Navigation("User"); 315 | }); 316 | 317 | modelBuilder.Entity("Domain.Entities.Star", b => 318 | { 319 | b.HasOne("Domain.Entities.Repository", "Repository") 320 | .WithMany("Stars") 321 | .HasForeignKey("RepositoryId") 322 | .OnDelete(DeleteBehavior.Cascade) 323 | .IsRequired(); 324 | 325 | b.HasOne("Domain.Entities.User", "User") 326 | .WithMany() 327 | .HasForeignKey("UserId") 328 | .OnDelete(DeleteBehavior.Cascade) 329 | .IsRequired(); 330 | 331 | b.Navigation("Repository"); 332 | 333 | b.Navigation("User"); 334 | }); 335 | 336 | modelBuilder.Entity("Domain.Entities.Organization", b => 337 | { 338 | b.Navigation("Repositories"); 339 | 340 | b.Navigation("organizationMembers"); 341 | }); 342 | 343 | modelBuilder.Entity("Domain.Entities.Repository", b => 344 | { 345 | b.Navigation("Stars"); 346 | }); 347 | #pragma warning restore 612, 618 348 | } 349 | } 350 | } 351 | -------------------------------------------------------------------------------- /Data/Migrations/20230317214900_SecondMission.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Data.Context; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; 9 | 10 | #nullable disable 11 | 12 | namespace Data.Migrations 13 | { 14 | [DbContext(typeof(AppDbContext))] 15 | [Migration("20230317214900_SecondMission")] 16 | partial class SecondMission 17 | { 18 | /// 19 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 20 | { 21 | #pragma warning disable 612, 618 22 | modelBuilder 23 | .HasAnnotation("ProductVersion", "7.0.4") 24 | .HasAnnotation("Relational:MaxIdentifierLength", 63); 25 | 26 | NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); 27 | 28 | modelBuilder.Entity("Domain.Entities.Follower", b => 29 | { 30 | b.Property("Id") 31 | .ValueGeneratedOnAdd() 32 | .HasColumnType("bigint"); 33 | 34 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 35 | 36 | b.Property("CreatedAt") 37 | .HasColumnType("timestamp with time zone"); 38 | 39 | b.Property("UpdatedAt") 40 | .HasColumnType("timestamp with time zone"); 41 | 42 | b.Property("UserId") 43 | .HasColumnType("bigint"); 44 | 45 | b.HasKey("Id"); 46 | 47 | b.HasIndex("UserId"); 48 | 49 | b.ToTable("Followeres"); 50 | }); 51 | 52 | modelBuilder.Entity("Domain.Entities.Following", b => 53 | { 54 | b.Property("Id") 55 | .ValueGeneratedOnAdd() 56 | .HasColumnType("bigint"); 57 | 58 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 59 | 60 | b.Property("CreatedAt") 61 | .HasColumnType("timestamp with time zone"); 62 | 63 | b.Property("UpdatedAt") 64 | .HasColumnType("timestamp with time zone"); 65 | 66 | b.Property("UserId") 67 | .HasColumnType("bigint"); 68 | 69 | b.HasKey("Id"); 70 | 71 | b.HasIndex("UserId"); 72 | 73 | b.ToTable("Followings"); 74 | }); 75 | 76 | modelBuilder.Entity("Domain.Entities.Languages", b => 77 | { 78 | b.Property("Id") 79 | .ValueGeneratedOnAdd() 80 | .HasColumnType("integer"); 81 | 82 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 83 | 84 | b.Property("Name") 85 | .HasColumnType("text"); 86 | 87 | b.Property("RepositoryId") 88 | .HasColumnType("bigint"); 89 | 90 | b.HasKey("Id"); 91 | 92 | b.ToTable("Languages"); 93 | }); 94 | 95 | modelBuilder.Entity("Domain.Entities.Organization", b => 96 | { 97 | b.Property("Id") 98 | .ValueGeneratedOnAdd() 99 | .HasColumnType("bigint"); 100 | 101 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 102 | 103 | b.Property("CreatedAt") 104 | .HasColumnType("timestamp with time zone"); 105 | 106 | b.Property("Description") 107 | .HasColumnType("text"); 108 | 109 | b.Property("Name") 110 | .HasColumnType("text"); 111 | 112 | b.Property("UpdatedAt") 113 | .HasColumnType("timestamp with time zone"); 114 | 115 | b.HasKey("Id"); 116 | 117 | b.ToTable("Organizations"); 118 | }); 119 | 120 | modelBuilder.Entity("Domain.Entities.OrganizationMember", b => 121 | { 122 | b.Property("Id") 123 | .ValueGeneratedOnAdd() 124 | .HasColumnType("bigint"); 125 | 126 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 127 | 128 | b.Property("CreatedAt") 129 | .HasColumnType("timestamp with time zone"); 130 | 131 | b.Property("OrganizationId") 132 | .HasColumnType("bigint"); 133 | 134 | b.Property("UpdatedAt") 135 | .HasColumnType("timestamp with time zone"); 136 | 137 | b.Property("UserId") 138 | .HasColumnType("bigint"); 139 | 140 | b.HasKey("Id"); 141 | 142 | b.HasIndex("OrganizationId"); 143 | 144 | b.HasIndex("UserId"); 145 | 146 | b.ToTable("OrganizationMember"); 147 | }); 148 | 149 | modelBuilder.Entity("Domain.Entities.Repository", b => 150 | { 151 | b.Property("Id") 152 | .ValueGeneratedOnAdd() 153 | .HasColumnType("bigint"); 154 | 155 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 156 | 157 | b.Property("CreatedAt") 158 | .HasColumnType("timestamp with time zone"); 159 | 160 | b.Property("Description") 161 | .HasColumnType("text"); 162 | 163 | b.Property("Name") 164 | .HasColumnType("text"); 165 | 166 | b.Property("OrganizationId") 167 | .HasColumnType("bigint"); 168 | 169 | b.Property("RepositoryType") 170 | .HasColumnType("integer"); 171 | 172 | b.Property("StarsCount") 173 | .HasColumnType("integer"); 174 | 175 | b.Property("UpdatedAt") 176 | .HasColumnType("timestamp with time zone"); 177 | 178 | b.Property("UserId") 179 | .HasColumnType("bigint"); 180 | 181 | b.HasKey("Id"); 182 | 183 | b.HasIndex("OrganizationId"); 184 | 185 | b.HasIndex("UserId"); 186 | 187 | b.ToTable("Repositories"); 188 | }); 189 | 190 | modelBuilder.Entity("Domain.Entities.Star", b => 191 | { 192 | b.Property("Id") 193 | .ValueGeneratedOnAdd() 194 | .HasColumnType("bigint"); 195 | 196 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 197 | 198 | b.Property("CreatedAt") 199 | .HasColumnType("timestamp with time zone"); 200 | 201 | b.Property("RepositoryId") 202 | .HasColumnType("bigint"); 203 | 204 | b.Property("UpdatedAt") 205 | .HasColumnType("timestamp with time zone"); 206 | 207 | b.Property("UserId") 208 | .HasColumnType("bigint"); 209 | 210 | b.HasKey("Id"); 211 | 212 | b.HasIndex("RepositoryId"); 213 | 214 | b.HasIndex("UserId"); 215 | 216 | b.ToTable("Stars"); 217 | }); 218 | 219 | modelBuilder.Entity("Domain.Entities.User", b => 220 | { 221 | b.Property("Id") 222 | .ValueGeneratedOnAdd() 223 | .HasColumnType("bigint"); 224 | 225 | NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); 226 | 227 | b.Property("CreatedAt") 228 | .HasColumnType("timestamp with time zone"); 229 | 230 | b.Property("Description") 231 | .HasColumnType("text"); 232 | 233 | b.Property("Email") 234 | .HasColumnType("text"); 235 | 236 | b.Property("FirstName") 237 | .HasColumnType("text"); 238 | 239 | b.Property("LastName") 240 | .HasColumnType("text"); 241 | 242 | b.Property("Link") 243 | .HasColumnType("text"); 244 | 245 | b.Property("Password") 246 | .IsRequired() 247 | .HasColumnType("text"); 248 | 249 | b.Property("UpdatedAt") 250 | .HasColumnType("timestamp with time zone"); 251 | 252 | b.HasKey("Id"); 253 | 254 | b.ToTable("Users"); 255 | }); 256 | 257 | modelBuilder.Entity("Domain.Entities.Follower", b => 258 | { 259 | b.HasOne("Domain.Entities.User", "User") 260 | .WithMany() 261 | .HasForeignKey("UserId") 262 | .OnDelete(DeleteBehavior.Cascade) 263 | .IsRequired(); 264 | 265 | b.Navigation("User"); 266 | }); 267 | 268 | modelBuilder.Entity("Domain.Entities.Following", b => 269 | { 270 | b.HasOne("Domain.Entities.User", "User") 271 | .WithMany() 272 | .HasForeignKey("UserId") 273 | .OnDelete(DeleteBehavior.Cascade) 274 | .IsRequired(); 275 | 276 | b.Navigation("User"); 277 | }); 278 | 279 | modelBuilder.Entity("Domain.Entities.OrganizationMember", b => 280 | { 281 | b.HasOne("Domain.Entities.Organization", "Organization") 282 | .WithMany("organizationMembers") 283 | .HasForeignKey("OrganizationId") 284 | .OnDelete(DeleteBehavior.Cascade) 285 | .IsRequired(); 286 | 287 | b.HasOne("Domain.Entities.User", "User") 288 | .WithMany() 289 | .HasForeignKey("UserId") 290 | .OnDelete(DeleteBehavior.Cascade) 291 | .IsRequired(); 292 | 293 | b.Navigation("Organization"); 294 | 295 | b.Navigation("User"); 296 | }); 297 | 298 | modelBuilder.Entity("Domain.Entities.Repository", b => 299 | { 300 | b.HasOne("Domain.Entities.Organization", "Organization") 301 | .WithMany("Repositories") 302 | .HasForeignKey("OrganizationId") 303 | .OnDelete(DeleteBehavior.Cascade) 304 | .IsRequired(); 305 | 306 | b.HasOne("Domain.Entities.User", "User") 307 | .WithMany() 308 | .HasForeignKey("UserId") 309 | .OnDelete(DeleteBehavior.Cascade) 310 | .IsRequired(); 311 | 312 | b.Navigation("Organization"); 313 | 314 | b.Navigation("User"); 315 | }); 316 | 317 | modelBuilder.Entity("Domain.Entities.Star", b => 318 | { 319 | b.HasOne("Domain.Entities.Repository", "Repository") 320 | .WithMany("Stars") 321 | .HasForeignKey("RepositoryId") 322 | .OnDelete(DeleteBehavior.Cascade) 323 | .IsRequired(); 324 | 325 | b.HasOne("Domain.Entities.User", "User") 326 | .WithMany() 327 | .HasForeignKey("UserId") 328 | .OnDelete(DeleteBehavior.Cascade) 329 | .IsRequired(); 330 | 331 | b.Navigation("Repository"); 332 | 333 | b.Navigation("User"); 334 | }); 335 | 336 | modelBuilder.Entity("Domain.Entities.Organization", b => 337 | { 338 | b.Navigation("Repositories"); 339 | 340 | b.Navigation("organizationMembers"); 341 | }); 342 | 343 | modelBuilder.Entity("Domain.Entities.Repository", b => 344 | { 345 | b.Navigation("Stars"); 346 | }); 347 | #pragma warning restore 612, 618 348 | } 349 | } 350 | } 351 | --------------------------------------------------------------------------------