diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Address.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Address.cs index e7419ff9..a2ef6f19 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Address.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Address.cs @@ -1,23 +1,23 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Address -{ - public int Id { get; set; } - - public string City { get; set; } = null!; - - public string Country { get; set; } = null!; - - public string Street { get; set; } = null!; - - public string State { get; set; } = null!; - - public string? ZipCode { get; set; } - - public virtual ICollection Events { get; set; } = new List(); - - public virtual ICollection Users { get; set; } = new List(); -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Address +{ + public int Id { get; set; } + + public string City { get; set; } = null!; + + public string Country { get; set; } = null!; + + public string Street { get; set; } = null!; + + public string State { get; set; } = null!; + + public string? ZipCode { get; set; } + + public virtual ICollection Events { get; set; } = new List(); + + public virtual ICollection Users { get; set; } = new List(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Comment.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Comment.cs index 2feb191a..61500f58 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Comment.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Comment.cs @@ -1,21 +1,21 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Comment -{ - public int Id { get; set; } - - public int EventId { get; set; } - - public string Content { get; set; } = null!; - - public DateTime CreatedAt { get; set; } - - public int UserId { get; set; } - - public virtual Event Event { get; set; } = null!; - - public virtual User User { get; set; } = null!; -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Comment +{ + public int Id { get; set; } + + public int EventId { get; set; } + + public string Content { get; set; } = null!; + + public DateTime CreatedAt { get; set; } + + public int UserId { get; set; } + + public virtual Event Event { get; set; } = null!; + + public virtual User User { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Event.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Event.cs index e8bceabc..4235304c 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Event.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Event.cs @@ -1,39 +1,43 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Event -{ - public int Id { get; set; } - - public string Name { get; set; } = null!; - - public int AddressId { get; set; } - - public string Description { get; set; } = null!; - - public int OrganizerId { get; set; } - - public DateTime StartAt { get; set; } - - public DateTime EndAt { get; set; } - - public DateTime CreatedAt { get; set; } - - public DateTime UpdatedAt { get; set; } - - public string Slug { get; set; } = null!; - - public int StatusId { get; set; } - - public virtual Address Address { get; set; } = null!; - - public virtual ICollection Comments { get; set; } = new List(); - - public virtual User Organizer { get; set; } = null!; - - public virtual ICollection Participants { get; set; } = new List(); - - public virtual Status Status { get; set; } = null!; -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Event +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public int AddressId { get; set; } + + public string Description { get; set; } = null!; + + public int OrganizerId { get; set; } + + public DateTime StartAt { get; set; } + + public DateTime EndAt { get; set; } + + public DateTime CreatedAt { get; set; } + + public DateTime UpdatedAt { get; set; } + + public string Slug { get; set; } = null!; + + public int StatusId { get; set; } + + public virtual Address Address { get; set; } = null!; + + public virtual ICollection Comments { get; set; } = new List(); + + public virtual User Organizer { get; set; } = null!; + + public virtual ICollection Participants { get; set; } = new List(); + + public virtual Status Status { get; set; } = null!; + + public virtual ICollection Parameters { get; set; } = new List(); + + public virtual ICollection Tags { get; set; } = new List(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Image.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Image.cs index 0bf25075..2a00a6c9 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Image.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Image.cs @@ -1,17 +1,17 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Image -{ - public int Id { get; set; } - - public byte[] ImageData { get; set; } = null!; - - public int ObjectTypeId { get; set; } - - public int ObjectId { get; set; } - - public virtual ObjectType ObjectType { get; set; } = null!; -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Image +{ + public int Id { get; set; } + + public byte[] ImageData { get; set; } = null!; + + public int ObjectTypeId { get; set; } + + public int ObjectId { get; set; } + + public virtual ObjectType ObjectType { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Interest.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Interest.cs index 56c89b91..92fd2ed5 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Interest.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Interest.cs @@ -1,13 +1,13 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Interest -{ - public int Id { get; set; } - - public string Name { get; set; } = null!; - - public int Level { get; set; } -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Interest +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public virtual ICollection UserInterests { get; set; } = new List(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/ObjectType.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/ObjectType.cs index c02354eb..80caa231 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/ObjectType.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/ObjectType.cs @@ -1,15 +1,15 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class ObjectType -{ - public int Id { get; set; } - - public string Name { get; set; } = null!; - - public virtual ICollection Images { get; set; } = new List(); - - public virtual ICollection Statuses { get; set; } = new List(); -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class ObjectType +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public virtual ICollection Images { get; set; } = new List(); + + public virtual ICollection Statuses { get; set; } = new List(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Parameter.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Parameter.cs index f1d4d72a..188a91b9 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Parameter.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Parameter.cs @@ -1,13 +1,15 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Parameter -{ - public int Id { get; set; } - - public string Key { get; set; } = null!; - - public string Value { get; set; } = null!; -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Parameter +{ + public int Id { get; set; } + + public string Key { get; set; } = null!; + + public string Value { get; set; } = null!; + + public virtual ICollection Events { get; set; } = new List(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Participant.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Participant.cs index 3c867a77..2839e538 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Participant.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Participant.cs @@ -1,21 +1,21 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Participant -{ - public int Id { get; set; } - - public int EventId { get; set; } - - public int UserId { get; set; } - - public int StatusId { get; set; } - - public virtual Event Event { get; set; } = null!; - - public virtual Status Status { get; set; } = null!; - - public virtual User User { get; set; } = null!; -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Participant +{ + public int Id { get; set; } + + public int EventId { get; set; } + + public int UserId { get; set; } + + public int StatusId { get; set; } + + public virtual Event Event { get; set; } = null!; + + public virtual Status Status { get; set; } = null!; + + public virtual User User { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/ReasnContext.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/ReasnContext.cs index aa4c646a..5b245116 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/ReasnContext.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/ReasnContext.cs @@ -1,372 +1,348 @@ -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore; - -namespace ReasnAPI.Models.Database; - -public partial class ReasnContext : DbContext -{ - public ReasnContext() - { - } - - public ReasnContext(DbContextOptions options) - : base(options) - { - } - - public virtual DbSet
Addresses { get; set; } - - public virtual DbSet Comments { get; set; } - - public virtual DbSet Events { get; set; } - - public virtual DbSet EventParameters { get; set; } - - public virtual DbSet EventTags { get; set; } - - public virtual DbSet Images { get; set; } - - public virtual DbSet Interests { get; set; } - - public virtual DbSet ObjectTypes { get; set; } - - public virtual DbSet Parameters { get; set; } - - public virtual DbSet Participants { get; set; } - - public virtual DbSet Roles { get; set; } - - public virtual DbSet Statuses { get; set; } - - public virtual DbSet Tags { get; set; } - - public virtual DbSet Users { get; set; } - - public virtual DbSet UserInterests { get; set; } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - => optionsBuilder.UseNpgsql("name=ConnectionStrings:DefaultValue"); - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity
(entity => - { - entity.HasKey(e => e.Id).HasName("address_pkey"); - - entity.ToTable("address", "common"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.City) - .HasMaxLength(255) - .HasColumnName("city"); - entity.Property(e => e.Country) - .HasMaxLength(255) - .HasColumnName("country"); - entity.Property(e => e.State) - .HasMaxLength(255) - .HasColumnName("state"); - entity.Property(e => e.Street) - .HasMaxLength(255) - .HasColumnName("street"); - entity.Property(e => e.ZipCode) - .HasMaxLength(255) - .HasColumnName("zip_code"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("comment_pkey"); - - entity.ToTable("comment", "events"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.Content) - .HasMaxLength(255) - .HasColumnName("content"); - entity.Property(e => e.CreatedAt).HasColumnName("created_at"); - entity.Property(e => e.EventId).HasColumnName("event_id"); - entity.Property(e => e.UserId).HasColumnName("user_id"); - - entity.HasOne(d => d.Event).WithMany(p => p.Comments) - .HasForeignKey(d => d.EventId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("comment_event_id_fkey"); - - entity.HasOne(d => d.User).WithMany(p => p.Comments) - .HasForeignKey(d => d.UserId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("comment_user_id_fkey"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("event_pkey"); - - entity.ToTable("event", "events"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.AddressId).HasColumnName("address_id"); - entity.Property(e => e.CreatedAt).HasColumnName("created_at"); - entity.Property(e => e.Description).HasColumnName("description"); - entity.Property(e => e.EndAt).HasColumnName("end_at"); - entity.Property(e => e.Name) - .HasColumnType("character varying") - .HasColumnName("name"); - entity.Property(e => e.OrganizerId).HasColumnName("organizer_id"); - entity.Property(e => e.Slug) - .HasColumnType("character varying") - .HasColumnName("slug"); - entity.Property(e => e.StartAt).HasColumnName("start_at"); - entity.Property(e => e.StatusId).HasColumnName("status_id"); - entity.Property(e => e.UpdatedAt).HasColumnName("updated_at"); - - entity.HasOne(d => d.Address).WithMany(p => p.Events) - .HasForeignKey(d => d.AddressId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("event_address_id_fkey"); - - entity.HasOne(d => d.Organizer).WithMany(p => p.Events) - .HasForeignKey(d => d.OrganizerId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("event_organizer_id_fkey"); - - entity.HasOne(d => d.Status).WithMany(p => p.Events) - .HasForeignKey(d => d.StatusId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("event_status_id_fkey"); - }); - - modelBuilder.Entity(entity => - { - entity - .HasNoKey() - .ToTable("event_parameter", "events"); - - entity.Property(e => e.EventId).HasColumnName("event_id"); - entity.Property(e => e.ParameterId).HasColumnName("parameter_id"); - - entity.HasOne(d => d.Event).WithMany() - .HasForeignKey(d => d.EventId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("event_parameter_event_id_fkey"); - - entity.HasOne(d => d.Parameter).WithMany() - .HasForeignKey(d => d.ParameterId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("event_parameter_parameter_id_fkey"); - }); - - modelBuilder.Entity(entity => - { - entity - .HasNoKey() - .ToTable("event_tag", "events"); - - entity.Property(e => e.EventId).HasColumnName("event_id"); - entity.Property(e => e.TagId).HasColumnName("tag_id"); - - entity.HasOne(d => d.Event).WithMany() - .HasForeignKey(d => d.EventId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("event_tag_event_id_fkey"); - - entity.HasOne(d => d.Tag).WithMany() - .HasForeignKey(d => d.TagId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("event_tag_tag_id_fkey"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("image_pkey"); - - entity.ToTable("image", "common"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.ImageData).HasColumnName("image_data"); - entity.Property(e => e.ObjectId).HasColumnName("object_id"); - entity.Property(e => e.ObjectTypeId).HasColumnName("object_type_id"); - - entity.HasOne(d => d.ObjectType).WithMany(p => p.Images) - .HasForeignKey(d => d.ObjectTypeId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("image_object_type_id_fkey"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("interest_pkey"); - - entity.ToTable("interest", "users"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.Level).HasColumnName("level"); - entity.Property(e => e.Name) - .HasMaxLength(255) - .HasColumnName("name"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("object_type_pkey"); - - entity.ToTable("object_type", "common"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.Name) - .HasMaxLength(255) - .HasColumnName("name"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("parameter_pkey"); - - entity.ToTable("parameter", "events"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.Key) - .HasMaxLength(255) - .HasColumnName("key"); - entity.Property(e => e.Value) - .HasMaxLength(255) - .HasColumnName("value"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("participant_pkey"); - - entity.ToTable("participant", "events"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.EventId).HasColumnName("event_id"); - entity.Property(e => e.StatusId).HasColumnName("status_id"); - entity.Property(e => e.UserId).HasColumnName("user_id"); - - entity.HasOne(d => d.Event).WithMany(p => p.Participants) - .HasForeignKey(d => d.EventId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("participant_event_id_fkey"); - - entity.HasOne(d => d.Status).WithMany(p => p.Participants) - .HasForeignKey(d => d.StatusId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("participant_status_id_fkey"); - - entity.HasOne(d => d.User).WithMany(p => p.Participants) - .HasForeignKey(d => d.UserId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("participant_user_id_fkey"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("role_pkey"); - - entity.ToTable("role", "users"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.Name) - .HasMaxLength(255) - .HasColumnName("name"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("status_pkey"); - - entity.ToTable("status", "common"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.Name) - .HasMaxLength(255) - .HasColumnName("name"); - entity.Property(e => e.ObjectTypeId).HasColumnName("object_type_id"); - - entity.HasOne(d => d.ObjectType).WithMany(p => p.Statuses) - .HasForeignKey(d => d.ObjectTypeId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("status_object_type_id_fkey"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("tag_pkey"); - - entity.ToTable("tag", "events"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.Name) - .HasMaxLength(255) - .HasColumnName("name"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("user_pkey"); - - entity.ToTable("user", "users"); - - entity.Property(e => e.Id).HasColumnName("id"); - entity.Property(e => e.AddressId).HasColumnName("address_id"); - entity.Property(e => e.CreatedAt).HasColumnName("created_at"); - entity.Property(e => e.Email) - .HasMaxLength(255) - .HasColumnName("email"); - entity.Property(e => e.IsActive).HasColumnName("is_active"); - entity.Property(e => e.Name) - .HasMaxLength(255) - .HasColumnName("name"); - entity.Property(e => e.Password) - .HasMaxLength(255) - .HasColumnName("password"); - entity.Property(e => e.Phone) - .HasMaxLength(255) - .HasColumnName("phone"); - entity.Property(e => e.RoleId).HasColumnName("role_id"); - entity.Property(e => e.Surname) - .HasMaxLength(255) - .HasColumnName("surname"); - entity.Property(e => e.UpdatedAt).HasColumnName("updated_at"); - entity.Property(e => e.Username) - .HasMaxLength(255) - .HasColumnName("username"); - - entity.HasOne(d => d.Address).WithMany(p => p.Users) - .HasForeignKey(d => d.AddressId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("user_address_id_fkey"); - - entity.HasOne(d => d.Role).WithMany(p => p.Users) - .HasForeignKey(d => d.RoleId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("user_role_id_fkey"); - }); - - modelBuilder.Entity(entity => - { - entity - .HasNoKey() - .ToTable("user_interest", "users"); - - entity.Property(e => e.InterestId).HasColumnName("interest_id"); - entity.Property(e => e.UserId).HasColumnName("user_id"); - - entity.HasOne(d => d.Interest).WithMany() - .HasForeignKey(d => d.InterestId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("user_interest_interest_id_fkey"); - - entity.HasOne(d => d.User).WithMany() - .HasForeignKey(d => d.UserId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("user_interest_user_id_fkey"); - }); - - OnModelCreatingPartial(modelBuilder); - } - - partial void OnModelCreatingPartial(ModelBuilder modelBuilder); -} +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace ReasnAPI.Models.Database; + +public partial class ReasnContext : DbContext +{ + public ReasnContext() + { + } + + public ReasnContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet
Addresses { get; set; } + + public virtual DbSet Comments { get; set; } + + public virtual DbSet Events { get; set; } + + public virtual DbSet Images { get; set; } + + public virtual DbSet Interests { get; set; } + + public virtual DbSet ObjectTypes { get; set; } + + public virtual DbSet Parameters { get; set; } + + public virtual DbSet Participants { get; set; } + + public virtual DbSet Roles { get; set; } + + public virtual DbSet Statuses { get; set; } + + public virtual DbSet Tags { get; set; } + + public virtual DbSet Users { get; set; } + + public virtual DbSet UserInterests { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + => optionsBuilder.UseNpgsql("name=ConnectionStrings:DefaultValue"); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity
(entity => + { + entity.HasKey(e => e.Id).HasName("address_pkey"); + + entity.ToTable("address", "common"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.City).HasColumnName("city"); + entity.Property(e => e.Country).HasColumnName("country"); + entity.Property(e => e.State).HasColumnName("state"); + entity.Property(e => e.Street).HasColumnName("street"); + entity.Property(e => e.ZipCode).HasColumnName("zip_code"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("comment_pkey"); + + entity.ToTable("comment", "events"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Content).HasColumnName("content"); + entity.Property(e => e.CreatedAt).HasColumnName("created_at"); + entity.Property(e => e.EventId).HasColumnName("event_id"); + entity.Property(e => e.UserId).HasColumnName("user_id"); + + entity.HasOne(d => d.Event).WithMany(p => p.Comments) + .HasForeignKey(d => d.EventId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("comment_event_id_fkey"); + + entity.HasOne(d => d.User).WithMany(p => p.Comments) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("comment_user_id_fkey"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("event_pkey"); + + entity.ToTable("event", "events"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.AddressId).HasColumnName("address_id"); + entity.Property(e => e.CreatedAt).HasColumnName("created_at"); + entity.Property(e => e.Description).HasColumnName("description"); + entity.Property(e => e.EndAt).HasColumnName("end_at"); + entity.Property(e => e.Name).HasColumnName("name"); + entity.Property(e => e.OrganizerId).HasColumnName("organizer_id"); + entity.Property(e => e.Slug).HasColumnName("slug"); + entity.Property(e => e.StartAt).HasColumnName("start_at"); + entity.Property(e => e.StatusId).HasColumnName("status_id"); + entity.Property(e => e.UpdatedAt).HasColumnName("updated_at"); + + entity.HasOne(d => d.Address).WithMany(p => p.Events) + .HasForeignKey(d => d.AddressId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_address_id_fkey"); + + entity.HasOne(d => d.Organizer).WithMany(p => p.Events) + .HasForeignKey(d => d.OrganizerId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_organizer_id_fkey"); + + entity.HasOne(d => d.Status).WithMany(p => p.Events) + .HasForeignKey(d => d.StatusId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_status_id_fkey"); + + entity.HasMany(d => d.Tags).WithMany(p => p.Events) + .UsingEntity>( + "EventTag", + r => r.HasOne().WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_tag_tag_id_fkey"), + l => l.HasOne().WithMany() + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_tag_event_id_fkey"), + j => + { + j.HasKey("EventId", "TagId").HasName("event_tag_pkey"); + j.ToTable("event_tag", "events"); + j.IndexerProperty("EventId").HasColumnName("event_id"); + j.IndexerProperty("TagId").HasColumnName("tag_id"); + }); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("image_pkey"); + + entity.ToTable("image", "common"); + + entity.HasIndex(e => new { e.ObjectTypeId, e.ObjectId }, "unique_image_for_user") + .IsUnique() + .HasFilter("(object_type_id = 2)"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.ImageData).HasColumnName("image_data"); + entity.Property(e => e.ObjectId).HasColumnName("object_id"); + entity.Property(e => e.ObjectTypeId).HasColumnName("object_type_id"); + + entity.HasOne(d => d.ObjectType).WithMany(p => p.Images) + .HasForeignKey(d => d.ObjectTypeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("image_object_type_id_fkey"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("interest_pkey"); + + entity.ToTable("interest", "users"); + + entity.HasIndex(e => e.Name, "interest_name_key").IsUnique(); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Name).HasColumnName("name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("object_type_pkey"); + + entity.ToTable("object_type", "common"); + + entity.HasIndex(e => e.Name, "object_type_name_key").IsUnique(); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Name).HasColumnName("name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("parameter_pkey"); + + entity.ToTable("parameter", "events"); + + entity.HasIndex(e => new { e.Key, e.Value }, "parameter_key_value_key").IsUnique(); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Key).HasColumnName("key"); + entity.Property(e => e.Value).HasColumnName("value"); + + entity.HasMany(d => d.Events).WithMany(p => p.Parameters) + .UsingEntity>( + "EventParameter", + r => r.HasOne().WithMany() + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_parameter_event_id_fkey"), + l => l.HasOne().WithMany() + .HasForeignKey("ParameterId") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_parameter_parameter_id_fkey"), + j => + { + j.HasKey("ParameterId", "EventId").HasName("event_parameter_pkey"); + j.ToTable("event_parameter", "events"); + j.IndexerProperty("ParameterId").HasColumnName("parameter_id"); + j.IndexerProperty("EventId").HasColumnName("event_id"); + }); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("participant_pkey"); + + entity.ToTable("participant", "events"); + + entity.HasIndex(e => new { e.EventId, e.UserId }, "participant_event_id_user_id_key").IsUnique(); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.EventId).HasColumnName("event_id"); + entity.Property(e => e.StatusId).HasColumnName("status_id"); + entity.Property(e => e.UserId).HasColumnName("user_id"); + + entity.HasOne(d => d.Event).WithMany(p => p.Participants) + .HasForeignKey(d => d.EventId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("participant_event_id_fkey"); + + entity.HasOne(d => d.Status).WithMany(p => p.Participants) + .HasForeignKey(d => d.StatusId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("participant_status_id_fkey"); + + entity.HasOne(d => d.User).WithMany(p => p.Participants) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("participant_user_id_fkey"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("role_pkey"); + + entity.ToTable("role", "users"); + + entity.HasIndex(e => e.Name, "role_name_key").IsUnique(); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Name).HasColumnName("name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("status_pkey"); + + entity.ToTable("status", "common"); + + entity.HasIndex(e => e.Name, "status_name_key").IsUnique(); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Name).HasColumnName("name"); + entity.Property(e => e.ObjectTypeId).HasColumnName("object_type_id"); + + entity.HasOne(d => d.ObjectType).WithMany(p => p.Statuses) + .HasForeignKey(d => d.ObjectTypeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("status_object_type_id_fkey"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("tag_pkey"); + + entity.ToTable("tag", "events"); + + entity.HasIndex(e => e.Name, "tag_name_key").IsUnique(); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Name).HasColumnName("name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("user_pkey"); + + entity.ToTable("user", "users"); + + entity.HasIndex(e => e.Email, "user_email_key").IsUnique(); + + entity.HasIndex(e => e.Phone, "user_phone_key").IsUnique(); + + entity.HasIndex(e => e.Username, "user_username_key").IsUnique(); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.AddressId).HasColumnName("address_id"); + entity.Property(e => e.CreatedAt).HasColumnName("created_at"); + entity.Property(e => e.Email).HasColumnName("email"); + entity.Property(e => e.IsActive).HasColumnName("is_active"); + entity.Property(e => e.Name).HasColumnName("name"); + entity.Property(e => e.Password).HasColumnName("password"); + entity.Property(e => e.Phone).HasColumnName("phone"); + entity.Property(e => e.RoleId).HasColumnName("role_id"); + entity.Property(e => e.Surname).HasColumnName("surname"); + entity.Property(e => e.UpdatedAt).HasColumnName("updated_at"); + entity.Property(e => e.Username).HasColumnName("username"); + + entity.HasOne(d => d.Address).WithMany(p => p.Users) + .HasForeignKey(d => d.AddressId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("user_address_id_fkey"); + + entity.HasOne(d => d.Role).WithMany(p => p.Users) + .HasForeignKey(d => d.RoleId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("user_role_id_fkey"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.UserId, e.InterestId }).HasName("user_interest_pkey"); + + entity.ToTable("user_interest", "users"); + + entity.Property(e => e.UserId).HasColumnName("user_id"); + entity.Property(e => e.InterestId).HasColumnName("interest_id"); + entity.Property(e => e.Level).HasColumnName("level"); + + entity.HasOne(d => d.Interest).WithMany(p => p.UserInterests) + .HasForeignKey(d => d.InterestId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("user_interest_interest_id_fkey"); + + entity.HasOne(d => d.User).WithMany(p => p.UserInterests) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("user_interest_user_id_fkey"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Role.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Role.cs index a996e058..cd41da86 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Role.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Role.cs @@ -1,13 +1,13 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Role -{ - public int Id { get; set; } - - public string Name { get; set; } = null!; - - public virtual ICollection Users { get; set; } = new List(); -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Role +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public virtual ICollection Users { get; set; } = new List(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Status.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Status.cs index 9f5ad714..a836e94c 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Status.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Status.cs @@ -1,19 +1,19 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Status -{ - public int Id { get; set; } - - public string Name { get; set; } = null!; - - public int ObjectTypeId { get; set; } - - public virtual ICollection Events { get; set; } = new List(); - - public virtual ObjectType ObjectType { get; set; } = null!; - - public virtual ICollection Participants { get; set; } = new List(); -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Status +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public int ObjectTypeId { get; set; } + + public virtual ICollection Events { get; set; } = new List(); + + public virtual ObjectType ObjectType { get; set; } = null!; + + public virtual ICollection Participants { get; set; } = new List(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Tag.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Tag.cs index d5f4981f..275f033a 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/Tag.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Tag.cs @@ -1,11 +1,13 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class Tag -{ - public int Id { get; set; } - - public string Name { get; set; } = null!; -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Tag +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public virtual ICollection Events { get; set; } = new List(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/User.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/User.cs index ed0c9345..72c3e51e 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/User.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/User.cs @@ -1,41 +1,43 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class User -{ - public int Id { get; set; } - - public string Name { get; set; } = null!; - - public string Surname { get; set; } = null!; - - public string Username { get; set; } = null!; - - public string Password { get; set; } = null!; - - public DateTime CreatedAt { get; set; } - - public DateTime UpdatedAt { get; set; } - - public int RoleId { get; set; } - - public string Email { get; set; } = null!; - - public bool IsActive { get; set; } - - public int AddressId { get; set; } - - public string? Phone { get; set; } - - public virtual Address Address { get; set; } = null!; - - public virtual ICollection Comments { get; set; } = new List(); - - public virtual ICollection Events { get; set; } = new List(); - - public virtual ICollection Participants { get; set; } = new List(); - - public virtual Role Role { get; set; } = null!; -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class User +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public string Surname { get; set; } = null!; + + public string Username { get; set; } = null!; + + public string Password { get; set; } = null!; + + public DateTime CreatedAt { get; set; } + + public DateTime UpdatedAt { get; set; } + + public int RoleId { get; set; } + + public string Email { get; set; } = null!; + + public bool IsActive { get; set; } + + public int AddressId { get; set; } + + public string? Phone { get; set; } + + public virtual Address Address { get; set; } = null!; + + public virtual ICollection Comments { get; set; } = new List(); + + public virtual ICollection Events { get; set; } = new List(); + + public virtual ICollection Participants { get; set; } = new List(); + + public virtual Role Role { get; set; } = null!; + + public virtual ICollection UserInterests { get; set; } = new List(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/UserInterest.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/UserInterest.cs index 7a41940e..09dc72df 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/Database/UserInterest.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/UserInterest.cs @@ -1,15 +1,17 @@ -using System; -using System.Collections.Generic; - -namespace ReasnAPI.Models.Database; - -public partial class UserInterest -{ - public int UserId { get; set; } - - public int InterestId { get; set; } - - public virtual Interest Interest { get; set; } = null!; - - public virtual User User { get; set; } = null!; -} +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class UserInterest +{ + public int UserId { get; set; } + + public int InterestId { get; set; } + + public int Level { get; set; } + + public virtual Interest Interest { get; set; } = null!; + + public virtual User User { get; set; } = null!; +}