forked from ddrilling/AsbCloudServer
1. Миграция на удаление привязки к id скважины
2. Изменен маршрут для faq-контроллера на api/faq
This commit is contained in:
parent
baab5cab4a
commit
97476265c2
8054
AsbCloudDb/Migrations/20230421071633_UpdateTable_t_faq_Id_Well_Remove.Designer.cs
generated
Normal file
8054
AsbCloudDb/Migrations/20230421071633_UpdateTable_t_faq_Id_Well_Remove.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,48 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class UpdateTable_t_faq_Id_Well_Remove : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_t_faq_t_well_id_well",
|
||||||
|
table: "t_faq");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_t_faq_id_well",
|
||||||
|
table: "t_faq");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "id_well",
|
||||||
|
table: "t_faq");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "id_well",
|
||||||
|
table: "t_faq",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0,
|
||||||
|
comment: "id скважины");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_t_faq_id_well",
|
||||||
|
table: "t_faq",
|
||||||
|
column: "id_well");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_t_faq_t_well_id_well",
|
||||||
|
table: "t_faq",
|
||||||
|
column: "id_well",
|
||||||
|
principalTable: "t_well",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -383,35 +383,28 @@ namespace AsbCloudDb.Migrations
|
|||||||
.HasColumnName("id_replacement_question")
|
.HasColumnName("id_replacement_question")
|
||||||
.HasComment("Ключ заменяющего вопроса");
|
.HasComment("Ключ заменяющего вопроса");
|
||||||
|
|
||||||
b.Property<int>("IdWell")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("id_well")
|
|
||||||
.HasComment("id скважины");
|
|
||||||
|
|
||||||
b.Property<bool>("IsFrequently")
|
b.Property<bool>("IsFrequently")
|
||||||
.HasColumnType("boolean")
|
.HasColumnType("boolean")
|
||||||
.HasColumnName("is_frequently")
|
.HasColumnName("is_frequently")
|
||||||
.HasComment("Частый вопрос");
|
.HasComment("Частый вопрос");
|
||||||
|
|
||||||
|
b.Property<string>("Question")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text")
|
||||||
|
.HasColumnName("question")
|
||||||
|
.HasComment("Текст вопроса");
|
||||||
|
|
||||||
b.Property<int>("State")
|
b.Property<int>("State")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("state")
|
.HasColumnName("state")
|
||||||
.HasComment("Статус вопроса");
|
.HasComment("Статус вопроса");
|
||||||
|
|
||||||
b.Property<string>("Text")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text")
|
|
||||||
.HasColumnName("question")
|
|
||||||
.HasComment("Текст вопроса");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("IdAuthorAnswer");
|
b.HasIndex("IdAuthorAnswer");
|
||||||
|
|
||||||
b.HasIndex("IdAuthorQuestion");
|
b.HasIndex("IdAuthorQuestion");
|
||||||
|
|
||||||
b.HasIndex("IdWell");
|
|
||||||
|
|
||||||
b.ToTable("t_faq");
|
b.ToTable("t_faq");
|
||||||
|
|
||||||
b.HasComment("вопросы пользователей");
|
b.HasComment("вопросы пользователей");
|
||||||
@ -7302,17 +7295,9 @@ namespace AsbCloudDb.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("IdWell")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("AuthorAnswer");
|
b.Navigation("AuthorAnswer");
|
||||||
|
|
||||||
b.Navigation("AuthorQuestion");
|
b.Navigation("AuthorQuestion");
|
||||||
|
|
||||||
b.Navigation("Well");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b =>
|
||||||
|
@ -2,13 +2,9 @@
|
|||||||
using AsbCloudApp.Exceptions;
|
using AsbCloudApp.Exceptions;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -17,18 +13,16 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// контроллер по работе с faq-вопросами
|
/// контроллер по работе с faq-вопросами
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Route("api/well/{idWell}/faq")]
|
[Route("api/faq")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class FaqController : ControllerBase
|
public class FaqController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IFaqRepository faqRepository;
|
private readonly IFaqRepository faqRepository;
|
||||||
private readonly IWellService wellService;
|
|
||||||
|
|
||||||
public FaqController(IFaqRepository faqRepository, IWellService wellService)
|
public FaqController(IFaqRepository faqRepository)
|
||||||
{
|
{
|
||||||
this.faqRepository = faqRepository;
|
this.faqRepository = faqRepository;
|
||||||
this.wellService = wellService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user