< Summary

Information
Class: Api.Auth.Models.UserTokenEF
Assembly: Api
File(s): /home/runner/work/ProjectRead.ing/ProjectRead.ing/Api/Auth/Models/UserTokens.cs
Line coverage
50%
Covered lines: 1
Uncovered lines: 1
Coverable lines: 2
Total lines: 36
Line coverage: 50%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
get_Compare()100%210%

File(s)

/home/runner/work/ProjectRead.ing/ProjectRead.ing/Api/Auth/Models/UserTokens.cs

#LineLine coverage
 1// SPDX-FileCopyrightText: 2026 Alper Çelik <alper@alper-celik.dev>
 2//
 3// SPDX-License-Identifier: AGPL-3.0-or-later
 4
 5using System.ComponentModel.DataAnnotations;
 6using System.ComponentModel.DataAnnotations.Schema;
 7using System.Linq.Expressions;
 8using NodaTime;
 9
 10namespace Api.Auth.Models;
 11
 12[Table("user_tokens")]
 13public class UserTokenEF : ITokenTime
 14{
 15    public const string PermissionBitsType = "PermissionBitsType";
 16
 17    [ForeignKey(nameof(Owner))]
 18    public Guid UserId { get; set; }
 19
 20    public string? SessionName { get; set; }
 21
 22    [Key]
 23    public required byte[] TokenHash { get; set; }
 24
 25    public required UserPermissionBits Permissions { get; set; }
 26
 27    public Instant CreationTime { get; set; }
 28
 29    public Instant? LastUsed { get; set; }
 30
 31    // Navigation Properties
 132    public UserEF Owner { get; set; } = null!;
 33
 34    public Expression<Func<UserTokenEF, UserTokenEF, bool>> Compare =>
 035        (t1, t2) => t1.TokenHash.SequenceEqual(t2.TokenHash);
 36}

Methods/Properties

.ctor()
get_Compare()