ApiApplicationScope.cs 888 B

123456789101112131415161718192021222324252627282930313233
  1. using System.ComponentModel.DataAnnotations;
  2. using System.ComponentModel.DataAnnotations.Schema;
  3. namespace Domain.Entities.Developers;
  4. /// <summary>
  5. /// 앱이 요청한 scope 목록 (read:profile, read:donations, write:notes 등).
  6. /// </summary>
  7. public class ApiApplicationScope
  8. {
  9. [ForeignKey(nameof(ApplicationID))]
  10. public virtual ApiApplication? Application { get; private set; }
  11. [Key]
  12. public int ID { get; private set; }
  13. public int ApplicationID { get; private set; }
  14. public string Scope { get; private set; } = default!;
  15. public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
  16. private ApiApplicationScope() { }
  17. public static ApiApplicationScope Create(int applicationID, string scope)
  18. {
  19. return new ApiApplicationScope
  20. {
  21. ApplicationID = applicationID,
  22. Scope = scope
  23. };
  24. }
  25. }