| | | 1 | | // SPDX-FileCopyrightText: 2026 Alper Çelik <[email protected]> |
| | | 2 | | // |
| | | 3 | | // SPDX-License-Identifier: AGPL-3.0-or-later |
| | | 4 | | |
| | | 5 | | using System.ComponentModel.DataAnnotations; |
| | | 6 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 7 | | |
| | | 8 | | using Microsoft.EntityFrameworkCore; |
| | | 9 | | using Microsoft.EntityFrameworkCore.Metadata.Builders; |
| | | 10 | | |
| | | 11 | | namespace Api.Auth.Models; |
| | | 12 | | |
| | | 13 | | [Table("users")] |
| | | 14 | | [Index(nameof(Email), IsUnique = true)] |
| | | 15 | | public class User |
| | | 16 | | { |
| | | 17 | | public const string UserHandleAcceptedRegex = @"^[a-zA-Z0-9_\-]{3,30}$"; |
| | | 18 | | |
| | | 19 | | [Key] |
| | | 20 | | public Guid Id { get; set; } |
| | | 21 | | |
| | | 22 | | [EmailAddress] |
| | | 23 | | public required string Email { get; set; } |
| | | 24 | | |
| | | 25 | | public bool EmailVerified { get; set; } = false; |
| | | 26 | | |
| | | 27 | | public required string PasswordHash { get; set; } |
| | | 28 | | |
| | | 29 | | public bool Admin { get; set; } = false; |
| | | 30 | | } |
| | | 31 | | |
| | | 32 | | public class UserEntityTypeConfiguration : IEntityTypeConfiguration<User> |
| | | 33 | | { |
| | | 34 | | public void Configure(EntityTypeBuilder<User> builder) |
| | 1 | 35 | | { |
| | 1 | 36 | | } |
| | | 37 | | } |