| | | 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 GoogleIdTokenUseDbMap |
| | | 8 | | { |
| | | 9 | | public static void Configure(this EntityTypeBuilder<GoogleIdTokenUse> use) |
| | | 10 | | { |
| | 4 | 11 | | use.ToTable("google_id_token_use"); |
| | | 12 | | |
| | | 13 | | // FR-GO-21: the token's key is the primary key, so recording a use and finding an earlier one |
| | | 14 | | // are the same INSERT … ON CONFLICT DO NOTHING (AtomicWrites.TryRecordGoogleIdTokenUseAsync). |
| | 4 | 15 | | use.HasKey(x => x.Id); |
| | 4 | 16 | | use.Property(x => x.Id).HasColumnName("token_hash").HasMaxLength(64).ValueGeneratedNever(); |
| | | 17 | | |
| | | 18 | | // The purge selects on it (NFR-19). |
| | 4 | 19 | | use.Property(x => x.ExpiresAt).IsRequired(); |
| | 4 | 20 | | use.HasIndex(x => x.ExpiresAt); |
| | 4 | 21 | | } |
| | | 22 | | } |