| | | 1 | | using ArturRios.Heimdall.Domain.Entities; |
| | | 2 | | using Microsoft.EntityFrameworkCore; |
| | | 3 | | using Microsoft.EntityFrameworkCore.Metadata.Builders; |
| | | 4 | | |
| | | 5 | | namespace ArturRios.Heimdall.Data.EntityMaps; |
| | | 6 | | |
| | | 7 | | internal static class ScopeDbMap |
| | | 8 | | { |
| | | 9 | | public static void Configure(this EntityTypeBuilder<Scope> scope) |
| | | 10 | | { |
| | 3 | 11 | | scope.ToTable("scope"); |
| | | 12 | | |
| | 3 | 13 | | scope.HasKey(x => x.Id); |
| | | 14 | | |
| | 3 | 15 | | scope.Property(x => x.PublicId).IsRequired(); |
| | 3 | 16 | | scope.HasIndex(x => x.PublicId).IsUnique(); |
| | | 17 | | |
| | 3 | 18 | | scope.Property(x => x.Name).IsRequired(); |
| | | 19 | | |
| | | 20 | | // Scope name is unique (FR-SC-01, AF-01a / AF-03b). |
| | 3 | 21 | | scope.HasIndex(x => x.Name).IsUnique(); |
| | | 22 | | |
| | 3 | 23 | | scope.Property(x => x.IsDeleted).HasDefaultValue(false); |
| | 3 | 24 | | scope.Property(x => x.GoogleSignInEnabled).HasDefaultValue(false); |
| | 3 | 25 | | scope.Property(x => x.SelfRegistrationEnabled).HasDefaultValue(false); |
| | | 26 | | |
| | 3 | 27 | | scope.Property(x => x.DefaultLegalBasis); |
| | 3 | 28 | | scope.Property(x => x.PrivacyNoticeUri); |
| | | 29 | | |
| | 3 | 30 | | scope.Property(x => x.EmailVerificationUrl); |
| | 3 | 31 | | scope.Property(x => x.PasswordResetUrl); |
| | | 32 | | |
| | 3 | 33 | | scope.Property(x => x.CreatedAt).HasDefaultValueSql("now()"); |
| | 3 | 34 | | scope.Property(x => x.UpdatedAt).HasDefaultValueSql("now()"); |
| | | 35 | | |
| | | 36 | | // Relationships to Application, GoogleUser, ScopeOwner and ScopeUser are configured from |
| | | 37 | | // their respective dependent-side maps. |
| | 3 | 38 | | } |
| | | 39 | | } |