| | | 1 | | // SPDX-FileCopyrightText: 2026 Alper Çelik <alper@alper-celik.dev> |
| | | 2 | | // |
| | | 3 | | // SPDX-License-Identifier: AGPL-3.0-or-later |
| | | 4 | | |
| | | 5 | | using System.ComponentModel.DataAnnotations; |
| | | 6 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 7 | | |
| | | 8 | | namespace Api.Auth.Models; |
| | | 9 | | |
| | | 10 | | [Table("remote_services")] |
| | | 11 | | public class RemoteService : IEntityMetadata |
| | | 12 | | { |
| | 1 | 13 | | public static string TheInstanceServiceName => "The Instance Service"; |
| | | 14 | | public static Guid TheInstanceServiceId => |
| | 1 | 15 | | new Guid("00000000-0000-7000-8000-000000000000").WithPostfix(IdPostfix); |
| | | 16 | | |
| | 1 | 17 | | public static byte IdPostfix => (byte)IdPostfixes.RemoteService; |
| | | 18 | | |
| | | 19 | | [Key] |
| | | 20 | | public Guid Id { get; set; } |
| | | 21 | | public int RowVersion { get; set; } |
| | | 22 | | public NodaTime.Instant MetadataAddedAt { get; set; } |
| | | 23 | | public NodaTime.Instant MetadataUpdatedAt { get; set; } |
| | | 24 | | |
| | | 25 | | public required string Name { get; set; } |
| | | 26 | | |
| | | 27 | | public bool IsInstanceService { get; set; } |
| | | 28 | | |
| | 1 | 29 | | public List<string> AllowedJobs { get; set; } = []; |
| | | 30 | | public required UserPermissionBits DefaultInstanceWidePermisssion { get; set; } |
| | | 31 | | |
| | | 32 | | [ForeignKey(nameof(Owner))] |
| | | 33 | | public Guid? OwnerId { get; set; } |
| | | 34 | | |
| | | 35 | | // Navigation Properties |
| | | 36 | | public UserEF? Owner { get; set; } |
| | 1 | 37 | | public List<RemoteServiceUserPermission> UserPermissions { get; set; } = null!; |
| | | 38 | | } |