uid colors

This commit is contained in:
azyges
2025-09-26 08:26:24 +09:00
parent c4b6e85f60
commit 323d3f39e2
4 changed files with 1252 additions and 2 deletions

View File

@@ -0,0 +1,53 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LightlessSyncServer.Migrations
{
/// <inheritdoc />
public partial class AddUserVanityFields : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "has_vanity",
table: "users",
type: "boolean",
nullable: true,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "text_color_hex",
table: "users",
type: "character varying(9)",
maxLength: 9,
nullable: true,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "text_glow_color_hex",
table: "users",
type: "character varying(9)",
maxLength: 9,
nullable: true,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "has_vanity",
table: "users");
migrationBuilder.DropColumn(
name: "text_color_hex",
table: "users");
migrationBuilder.DropColumn(
name: "text_glow_color_hex",
table: "users");
}
}
}

View File

@@ -1,4 +1,4 @@
// <auto-generated />
// <auto-generated />
using System;
using LightlessSyncShared.Data;
using Microsoft.EntityFrameworkCore;
@@ -683,6 +683,11 @@ namespace LightlessSyncServer.Migrations
.HasColumnType("character varying(15)")
.HasColumnName("alias");
b.Property<bool?>("HasVanity")
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("has_vanity");
b.Property<bool>("IsAdmin")
.HasColumnType("boolean")
.HasColumnName("is_admin");
@@ -695,6 +700,18 @@ namespace LightlessSyncServer.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("last_logged_in");
b.Property<string>("TextColorHex")
.HasMaxLength(9)
.HasColumnType("character varying(9)")
.HasDefaultValue(string.Empty)
.HasColumnName("text_color_hex");
b.Property<string>("TextGlowColorHex")
.HasMaxLength(9)
.HasColumnType("character varying(9)")
.HasDefaultValue(string.Empty)
.HasColumnName("text_glow_color_hex");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()

View File

@@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace LightlessSyncShared.Models;
@@ -14,6 +14,14 @@ public class User
public bool IsAdmin { get; set; } = false;
public bool? HasVanity { get; set; } = false;
[MaxLength(9)]
public string? TextColorHex { get; set; } = string.Empty;
[MaxLength(9)]
public string? TextGlowColorHex { get; set; } = string.Empty;
public DateTime LastLoggedIn { get; set; }
[MaxLength(15)]
public string Alias { get; set; }