| | | 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.Schema; |
| | | 6 | | using Microsoft.EntityFrameworkCore; |
| | | 7 | | using NodaTime; |
| | | 8 | | |
| | | 9 | | namespace Api.Auth.Models; |
| | | 10 | | |
| | | 11 | | [PrimaryKey(nameof(RemoteServiceId), nameof(UserId))] |
| | | 12 | | public class RemoteServiceUserPermission : ITokenTime |
| | | 13 | | { |
| | | 14 | | [ForeignKey(nameof(RemoteService))] |
| | | 15 | | public Guid RemoteServiceId { get; set; } |
| | | 16 | | |
| | | 17 | | [ForeignKey(nameof(User))] |
| | | 18 | | public Guid UserId { get; set; } |
| | | 19 | | |
| | | 20 | | public required UserPermissionBits Permissions { get; set; } |
| | | 21 | | |
| | | 22 | | public Instant CreationTime { get; set; } |
| | | 23 | | |
| | | 24 | | public Instant? LastUsed { get; set; } |
| | | 25 | | |
| | | 26 | | // Navigation Properties |
| | 1 | 27 | | public RemoteService RemoteService { get; set; } = null; |
| | 1 | 28 | | public UserEF User { get; set; } = null!; |
| | | 29 | | } |