Activity moderated
This commit is contained in:
parent
90dfe9c13f
commit
742da7c3f0
6 changed files with 4942 additions and 30 deletions
|
|
@ -12,8 +12,12 @@ namespace Yavsc.Helpers {
|
|||
this ApplicationDbContext _dbContext, List<UserActivity> activity)
|
||||
{
|
||||
var activities = activity.ToArray();
|
||||
var activityCodes = activities.Select(a=>a.DoesCode).ToArray();
|
||||
|
||||
List<SelectListItem> items = _dbContext.Activities.Select(
|
||||
var systemActivities = _dbContext.Activities.Where(a=>!a.Moderated
|
||||
&& activityCodes.Contains(a.Code)).ToArray();
|
||||
|
||||
List<SelectListItem> items = systemActivities.Select(
|
||||
x=> new SelectListItem() {
|
||||
Value = x.Code, Text = x.Name, Selected = activities.Any(a=>a.DoesCode == x.Code)
|
||||
} ).ToList();
|
||||
|
|
|
|||
4696
src/Yavsc.Org/Migrations/20260704154837_moderatedActivities.Designer.cs
generated
Normal file
4696
src/Yavsc.Org/Migrations/20260704154837_moderatedActivities.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
138
src/Yavsc.Org/Migrations/20260704154837_moderatedActivities.cs
Normal file
138
src/Yavsc.Org/Migrations/20260704154837_moderatedActivities.cs
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Yavsc.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class moderatedActivities : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MusicalPreference_GeneralSettings_GeneralSettingsUserId",
|
||||
table: "MusicalPreference");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "GeneralSettingsUserId",
|
||||
table: "MusicalPreference",
|
||||
newName: "MusicLoverSettingsUserId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_MusicalPreference_GeneralSettingsUserId",
|
||||
table: "MusicalPreference",
|
||||
newName: "IX_MusicalPreference_MusicLoverSettingsUserId");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Bug",
|
||||
type: "character varying(10240)",
|
||||
maxLength: 10240,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Moderated",
|
||||
table: "Activities",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Signatures",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
EstimateId = table.Column<long>(type: "bigint", nullable: false),
|
||||
SignerId = table.Column<string>(type: "text", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
CoordinateMax = table.Column<int>(type: "integer", nullable: false, defaultValue: 10000),
|
||||
Strokes = table.Column<int[]>(type: "integer[]", nullable: false),
|
||||
CapturedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
FilePath = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Signatures", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Signatures_AspNetUsers_SignerId",
|
||||
column: x => x.SignerId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Signatures_Estimates_EstimateId",
|
||||
column: x => x.EstimateId,
|
||||
principalTable: "Estimates",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Signatures_EstimateId_Type",
|
||||
table: "Signatures",
|
||||
columns: new[] { "EstimateId", "Type" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Signatures_SignerId",
|
||||
table: "Signatures",
|
||||
column: "SignerId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MusicalPreference_GeneralSettings_MusicLoverSettingsUserId",
|
||||
table: "MusicalPreference",
|
||||
column: "MusicLoverSettingsUserId",
|
||||
principalTable: "GeneralSettings",
|
||||
principalColumn: "UserId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MusicalPreference_GeneralSettings_MusicLoverSettingsUserId",
|
||||
table: "MusicalPreference");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Signatures");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Moderated",
|
||||
table: "Activities");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "MusicLoverSettingsUserId",
|
||||
table: "MusicalPreference",
|
||||
newName: "GeneralSettingsUserId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_MusicalPreference_MusicLoverSettingsUserId",
|
||||
table: "MusicalPreference",
|
||||
newName: "IX_MusicalPreference_GeneralSettingsUserId");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Bug",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(10240)",
|
||||
oldMaxLength: 10240,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MusicalPreference_GeneralSettings_GeneralSettingsUserId",
|
||||
table: "MusicalPreference",
|
||||
column: "GeneralSettingsUserId",
|
||||
principalTable: "GeneralSettings",
|
||||
principalColumn: "UserId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ namespace Yavsc.Migrations
|
|||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.8")
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
|
@ -1413,6 +1413,50 @@ namespace Yavsc.Migrations
|
|||
b.ToTable("ExceptionsSIREN");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Billing.Signature", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CapturedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("CoordinateMax")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(10000);
|
||||
|
||||
b.Property<long>("EstimateId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("FilePath")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SignerId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.PrimitiveCollection<int[]>("Strokes")
|
||||
.IsRequired()
|
||||
.HasColumnType("integer[]");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SignerId");
|
||||
|
||||
b.HasIndex("EstimateId", "Type")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Signatures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Blog.BlogAttachedFile", b =>
|
||||
{
|
||||
b.Property<long>("FileId")
|
||||
|
|
@ -2157,7 +2201,8 @@ namespace Yavsc.Migrations
|
|||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
.HasMaxLength(10240)
|
||||
.HasColumnType("character varying(10240)");
|
||||
|
||||
b.Property<long?>("FeatureId")
|
||||
.HasColumnType("bigint");
|
||||
|
|
@ -2534,7 +2579,7 @@ namespace Yavsc.Migrations
|
|||
b.Property<string>("DjSettingsUserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("GeneralSettingsUserId")
|
||||
b.Property<string>("MusicLoverSettingsUserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Rate")
|
||||
|
|
@ -2547,7 +2592,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.HasIndex("DjSettingsUserId");
|
||||
|
||||
b.HasIndex("GeneralSettingsUserId");
|
||||
b.HasIndex("MusicLoverSettingsUserId");
|
||||
|
||||
b.HasIndex("TendencyId");
|
||||
|
||||
|
|
@ -2585,16 +2630,6 @@ namespace Yavsc.Migrations
|
|||
b.ToTable("DjSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Musical.Profiles.GeneralSettings", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.ToTable("GeneralSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Musical.Profiles.Instrumentation", b =>
|
||||
{
|
||||
b.Property<long>("InstrumentId")
|
||||
|
|
@ -2610,6 +2645,16 @@ namespace Yavsc.Migrations
|
|||
b.ToTable("Instrumentation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Musical.Profiles.MusicLoverSettings", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.ToTable("GeneralSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Payment.PayPalPayment", b =>
|
||||
{
|
||||
b.Property<string>("CreationToken")
|
||||
|
|
@ -2894,6 +2939,9 @@ namespace Yavsc.Migrations
|
|||
b.Property<bool>("Hidden")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("Moderated")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ModeratorGroupName")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
|
@ -3737,6 +3785,25 @@ namespace Yavsc.Migrations
|
|||
b.Navigation("Query");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Billing.Signature", b =>
|
||||
{
|
||||
b.HasOne("Yavsc.Models.Billing.Estimate", "Estimate")
|
||||
.WithMany("Signatures")
|
||||
.HasForeignKey("EstimateId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Yavsc.Models.ApplicationUser", "Signer")
|
||||
.WithMany()
|
||||
.HasForeignKey("SignerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Estimate");
|
||||
|
||||
b.Navigation("Signer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Blog.BlogAttachedFile", b =>
|
||||
{
|
||||
b.HasOne("Yavsc.Models.Blog.UploadedFile", "File")
|
||||
|
|
@ -4162,9 +4229,9 @@ namespace Yavsc.Migrations
|
|||
.WithMany("SoundColor")
|
||||
.HasForeignKey("DjSettingsUserId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Musical.Profiles.GeneralSettings", null)
|
||||
b.HasOne("Yavsc.Models.Musical.Profiles.MusicLoverSettings", null)
|
||||
.WithMany("SoundColor")
|
||||
.HasForeignKey("GeneralSettingsUserId");
|
||||
.HasForeignKey("MusicLoverSettingsUserId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Musical.MusicalTendency", "MusicalTendency")
|
||||
.WithMany()
|
||||
|
|
@ -4519,6 +4586,8 @@ namespace Yavsc.Migrations
|
|||
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
|
||||
{
|
||||
b.Navigation("Bill");
|
||||
|
||||
b.Navigation("Signatures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b =>
|
||||
|
|
@ -4580,7 +4649,7 @@ namespace Yavsc.Migrations
|
|||
b.Navigation("SoundColor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Musical.Profiles.GeneralSettings", b =>
|
||||
modelBuilder.Entity("Yavsc.Models.Musical.Profiles.MusicLoverSettings", b =>
|
||||
{
|
||||
b.Navigation("SoundColor");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@ namespace Yavsc.Models.Workflow
|
|||
[Display(Name = "Photo")]
|
||||
public string? Photo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Moderated activity
|
||||
/// </summary>
|
||||
public bool Moderated { get; set; }
|
||||
|
||||
[InverseProperty("Context")]
|
||||
[DisplayAttribute(Name = "Services liés")]
|
||||
public List<Service> Services { get; set; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue