mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Adds the UserSettings aggregate with pagination and alpha picker preferences, keyed to a user with a dedicated UserId foreign key. Adds GET and PUT /users/me/settings API endpoints, a localized Tools > Settings page with save confirmation, the EF migration for the UserSettings table, and unit, integration and security tests.
54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Lumina.DataAccess.Common.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddsUserSettingsTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "UserSettings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
|
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
|
|
IsPaginationEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
ItemsPerPage = table.Column<int>(type: "INTEGER", nullable: false),
|
|
IgnoreThePrefixForAlphaPicker = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
CreatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
CreatedBy = table.Column<Guid>(type: "TEXT", nullable: false),
|
|
UpdatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: true),
|
|
UpdatedBy = table.Column<Guid>(type: "TEXT", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserSettings", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_UserSettings_Users_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "Users",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserSettings_UserId",
|
|
table: "UserSettings",
|
|
column: "UserId",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "UserSettings");
|
|
}
|
|
}
|
|
}
|