removed the authored surveys property
removed the responses property
removed CreateAnswerDto&AnswerDto
This commit is contained in:
2025-01-26 13:28:40 +02:00
parent 78900ab7ad
commit 77fc9dfd92
22 changed files with 904 additions and 38 deletions

View File

@@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using survey_beta.DataBaseContext;
using survey_beta.DTOs.Default;
using survey_beta.Mappers;
using survey_beta.Models;
using survey_beta.Services;
namespace survey_beta.Controllers
{
[Route("api/Surveys")]
[ApiController]
public class SurveyController : ControllerBase
{
}
}

View File

@@ -0,0 +1,11 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace survey_beta.Controllers
{
[Route("api/Users")]
[ApiController]
public class UsersController : ControllerBase
{
}
}

View File

@@ -1,9 +0,0 @@
namespace survey_beta.DTOs.Create
{
public class CreateAnswerDto
{
public string ResponseId { get; set; }
public string QuestionId { get; set; }
public string ChoiceId { get; set; }
}
}

View File

@@ -4,6 +4,5 @@
{
public string Letter { get; set; }
public string Content { get; set; }
public string QuestionId { get; set; } = Guid.NewGuid().ToString();
}
}

View File

@@ -4,6 +4,6 @@
{
public string Content { get; set; }
public string SurveyId { get; set; } = Guid.NewGuid().ToString();
public ICollection<CreateChoiceDto> Choices { get; set; }
public List<CreateChoiceDto> Choices { get; set; }
}
}

View File

@@ -4,6 +4,6 @@
{
public string IpAddress { get; set; }
public string SurveyId { get; set; }
public ICollection<CreateAnswerDto> Answers { get; set; }
public List<CreateAnswerDto> Answers { get; set; }
}
}

View File

@@ -7,6 +7,6 @@
public string Description { get; set; }
public string Category { get; set; }
public DateTime ExpirationDate { get; set; }
public ICollection<CreateQuestionDto> Questions { get; set; }
public List<CreateQuestionDto> Questions { get; set; }
}
}

View File

@@ -1,10 +0,0 @@
namespace survey_beta.DTOs.Default
{
public class AnswerDto
{
public string Id { get; set; }
public string ResponseId { get; set; }
public string QuestionId { get; set; }
public string ChoiceId { get; set; }
}
}

View File

@@ -2,7 +2,7 @@
{
public class ChoiceDto
{
public string Id { get; set; }
public string Id { get; set; } = Guid.NewGuid().ToString();
public string Letter { get; set; }
public string Content { get; set; }
public string QuestionId { get; set; }

View File

@@ -5,6 +5,6 @@
public string Id { get; set; }
public string Content { get; set; }
public string SurveyId { get; set; }
public ICollection<ChoiceDto> Choices { get; set; }
public List<ChoiceDto> Choices { get; set; }
}
}

View File

@@ -5,6 +5,6 @@
public string Id { get; set; }
public string IpAddress { get; set; }
public string SurveyId { get; set; }
public ICollection<AnswerDto> Answers { get; set; }
public List<AnswerDto> Answers { get; set; }
}
}

View File

@@ -9,7 +9,6 @@
public DateTime ExpirationDate { get; set; }
public bool IsPublished { get; set; }
public string AuthorId { get; set; }
public ICollection<QuestionDto> Questions { get; set; }
public ICollection<ResponseDto> Responses { get; set; }
public List<QuestionDto> Questions { get; set; }
}
}

View File

@@ -6,6 +6,5 @@
public string? Email { get; set; }
public string? Username { get; set; }
public string? Fullname { get; set; }
public ICollection<SurveyDto> AuthoredSurveys { get; set; }
}
}

View File

@@ -1,10 +1,11 @@
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;

using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using survey_beta.Models;
namespace survey_beta.DataBaseContext
{
public class AppDbContext : IdentityDbContext<User>
public class AppDbContext : Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext<User>
{
public override DbSet<User> Users { get; set; }

View File

@@ -0,0 +1,307 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using survey_beta.DataBaseContext;
#nullable disable
namespace survey_beta.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20250126102512_intit")]
partial class intit
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("survey_beta.Models.Answer", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ChoiceId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("QuestionId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ResponseId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ChoiceId");
b.HasIndex("QuestionId");
b.HasIndex("ResponseId");
b.ToTable("Answers");
});
modelBuilder.Entity("survey_beta.Models.Choice", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Content")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Letter")
.IsRequired()
.HasColumnType("text");
b.Property<string>("QuestionId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("QuestionId");
b.ToTable("Choices");
});
modelBuilder.Entity("survey_beta.Models.Question", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Content")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SurveyId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("SurveyId");
b.ToTable("Questions");
});
modelBuilder.Entity("survey_beta.Models.Response", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("IpAddress")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SurveyId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("SurveyId");
b.ToTable("Responses");
});
modelBuilder.Entity("survey_beta.Models.Survey", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("AuthorId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("ExpirationDate")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsPublished")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.ToTable("Surveys");
});
modelBuilder.Entity("survey_beta.Models.User", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.HasColumnType("text");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<string>("Fullname")
.HasColumnType("text");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasColumnType("text");
b.Property<string>("NormalizedUserName")
.HasColumnType("text");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasColumnType("text");
b.Property<string>("Username")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("User");
});
modelBuilder.Entity("survey_beta.Models.Answer", b =>
{
b.HasOne("survey_beta.Models.Choice", "Choice")
.WithMany()
.HasForeignKey("ChoiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("survey_beta.Models.Question", "Question")
.WithMany()
.HasForeignKey("QuestionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("survey_beta.Models.Response", "Response")
.WithMany("Answers")
.HasForeignKey("ResponseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Choice");
b.Navigation("Question");
b.Navigation("Response");
});
modelBuilder.Entity("survey_beta.Models.Choice", b =>
{
b.HasOne("survey_beta.Models.Question", "Question")
.WithMany("Choices")
.HasForeignKey("QuestionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Question");
});
modelBuilder.Entity("survey_beta.Models.Question", b =>
{
b.HasOne("survey_beta.Models.Survey", "Survey")
.WithMany("Questions")
.HasForeignKey("SurveyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Survey");
});
modelBuilder.Entity("survey_beta.Models.Response", b =>
{
b.HasOne("survey_beta.Models.Survey", "Survey")
.WithMany("Responses")
.HasForeignKey("SurveyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Survey");
});
modelBuilder.Entity("survey_beta.Models.Survey", b =>
{
b.HasOne("survey_beta.Models.User", "Author")
.WithMany("Surveys")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
});
modelBuilder.Entity("survey_beta.Models.Question", b =>
{
b.Navigation("Choices");
});
modelBuilder.Entity("survey_beta.Models.Response", b =>
{
b.Navigation("Answers");
});
modelBuilder.Entity("survey_beta.Models.Survey", b =>
{
b.Navigation("Questions");
b.Navigation("Responses");
});
modelBuilder.Entity("survey_beta.Models.User", b =>
{
b.Navigation("Surveys");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,212 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace survey_beta.Migrations
{
/// <inheritdoc />
public partial class intit : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "User",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Username = table.Column<string>(type: "text", nullable: true),
Fullname = table.Column<string>(type: "text", nullable: true),
Email = table.Column<string>(type: "text", nullable: true),
PasswordHash = table.Column<string>(type: "text", nullable: true),
UserName = table.Column<string>(type: "text", nullable: true),
NormalizedUserName = table.Column<string>(type: "text", nullable: true),
NormalizedEmail = table.Column<string>(type: "text", nullable: true),
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
SecurityStamp = table.Column<string>(type: "text", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
PhoneNumber = table.Column<string>(type: "text", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_User", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Surveys",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Title = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
Category = table.Column<string>(type: "text", nullable: false),
ExpirationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
IsPublished = table.Column<bool>(type: "boolean", nullable: false),
AuthorId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Surveys", x => x.Id);
table.ForeignKey(
name: "FK_Surveys_User_AuthorId",
column: x => x.AuthorId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Questions",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Content = table.Column<string>(type: "text", nullable: false),
SurveyId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Questions", x => x.Id);
table.ForeignKey(
name: "FK_Questions_Surveys_SurveyId",
column: x => x.SurveyId,
principalTable: "Surveys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Responses",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
IpAddress = table.Column<string>(type: "text", nullable: false),
SurveyId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Responses", x => x.Id);
table.ForeignKey(
name: "FK_Responses_Surveys_SurveyId",
column: x => x.SurveyId,
principalTable: "Surveys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Choices",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Letter = table.Column<string>(type: "text", nullable: false),
Content = table.Column<string>(type: "text", nullable: false),
QuestionId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Choices", x => x.Id);
table.ForeignKey(
name: "FK_Choices_Questions_QuestionId",
column: x => x.QuestionId,
principalTable: "Questions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Answers",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
ResponseId = table.Column<string>(type: "text", nullable: false),
QuestionId = table.Column<string>(type: "text", nullable: false),
ChoiceId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Answers", x => x.Id);
table.ForeignKey(
name: "FK_Answers_Choices_ChoiceId",
column: x => x.ChoiceId,
principalTable: "Choices",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Answers_Questions_QuestionId",
column: x => x.QuestionId,
principalTable: "Questions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Answers_Responses_ResponseId",
column: x => x.ResponseId,
principalTable: "Responses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Answers_ChoiceId",
table: "Answers",
column: "ChoiceId");
migrationBuilder.CreateIndex(
name: "IX_Answers_QuestionId",
table: "Answers",
column: "QuestionId");
migrationBuilder.CreateIndex(
name: "IX_Answers_ResponseId",
table: "Answers",
column: "ResponseId");
migrationBuilder.CreateIndex(
name: "IX_Choices_QuestionId",
table: "Choices",
column: "QuestionId");
migrationBuilder.CreateIndex(
name: "IX_Questions_SurveyId",
table: "Questions",
column: "SurveyId");
migrationBuilder.CreateIndex(
name: "IX_Responses_SurveyId",
table: "Responses",
column: "SurveyId");
migrationBuilder.CreateIndex(
name: "IX_Surveys_AuthorId",
table: "Surveys",
column: "AuthorId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Answers");
migrationBuilder.DropTable(
name: "Choices");
migrationBuilder.DropTable(
name: "Responses");
migrationBuilder.DropTable(
name: "Questions");
migrationBuilder.DropTable(
name: "Surveys");
migrationBuilder.DropTable(
name: "User");
}
}
}

View File

@@ -0,0 +1,304 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using survey_beta.DataBaseContext;
#nullable disable
namespace survey_beta.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("survey_beta.Models.Answer", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ChoiceId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("QuestionId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ResponseId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ChoiceId");
b.HasIndex("QuestionId");
b.HasIndex("ResponseId");
b.ToTable("Answers");
});
modelBuilder.Entity("survey_beta.Models.Choice", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Content")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Letter")
.IsRequired()
.HasColumnType("text");
b.Property<string>("QuestionId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("QuestionId");
b.ToTable("Choices");
});
modelBuilder.Entity("survey_beta.Models.Question", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Content")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SurveyId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("SurveyId");
b.ToTable("Questions");
});
modelBuilder.Entity("survey_beta.Models.Response", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("IpAddress")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SurveyId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("SurveyId");
b.ToTable("Responses");
});
modelBuilder.Entity("survey_beta.Models.Survey", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("AuthorId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("ExpirationDate")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsPublished")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.ToTable("Surveys");
});
modelBuilder.Entity("survey_beta.Models.User", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.HasColumnType("text");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<string>("Fullname")
.HasColumnType("text");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasColumnType("text");
b.Property<string>("NormalizedUserName")
.HasColumnType("text");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasColumnType("text");
b.Property<string>("Username")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("User");
});
modelBuilder.Entity("survey_beta.Models.Answer", b =>
{
b.HasOne("survey_beta.Models.Choice", "Choice")
.WithMany()
.HasForeignKey("ChoiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("survey_beta.Models.Question", "Question")
.WithMany()
.HasForeignKey("QuestionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("survey_beta.Models.Response", "Response")
.WithMany("Answers")
.HasForeignKey("ResponseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Choice");
b.Navigation("Question");
b.Navigation("Response");
});
modelBuilder.Entity("survey_beta.Models.Choice", b =>
{
b.HasOne("survey_beta.Models.Question", "Question")
.WithMany("Choices")
.HasForeignKey("QuestionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Question");
});
modelBuilder.Entity("survey_beta.Models.Question", b =>
{
b.HasOne("survey_beta.Models.Survey", "Survey")
.WithMany("Questions")
.HasForeignKey("SurveyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Survey");
});
modelBuilder.Entity("survey_beta.Models.Response", b =>
{
b.HasOne("survey_beta.Models.Survey", "Survey")
.WithMany("Responses")
.HasForeignKey("SurveyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Survey");
});
modelBuilder.Entity("survey_beta.Models.Survey", b =>
{
b.HasOne("survey_beta.Models.User", "Author")
.WithMany("Surveys")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
});
modelBuilder.Entity("survey_beta.Models.Question", b =>
{
b.Navigation("Choices");
});
modelBuilder.Entity("survey_beta.Models.Response", b =>
{
b.Navigation("Answers");
});
modelBuilder.Entity("survey_beta.Models.Survey", b =>
{
b.Navigation("Questions");
b.Navigation("Responses");
});
modelBuilder.Entity("survey_beta.Models.User", b =>
{
b.Navigation("Surveys");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -5,21 +5,31 @@ using survey_beta.Models;
using survey_beta.Services;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
var app = builder.Build();
// Configure the HTTP request pipeline.
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddIdentity<User, IdentityRole>()
.AddEntityFrameworkStores<AppDbContext>()
.AddDefaultTokenProviders();
builder.Services.AddScoped<UserService>();
builder.Services.AddScoped<UsersServices>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.MapControllers();
app.UseHttpsRedirection();

View File

@@ -0,0 +1,6 @@
namespace survey_beta.Services
{
public class AnalyticsServices
{
}
}

View File

@@ -0,0 +1,6 @@
namespace survey_beta.Services
{
public class ResponsesServices
{
}
}

View File

@@ -0,0 +1,6 @@
namespace survey_beta.Services
{
public class SurveyServices
{
}
}

View File

@@ -0,0 +1,6 @@
namespace survey_beta.Services
{
public class UsersServices
{
}
}