chore: add csharpier to husky, format backend with csharpier
This commit is contained in:
parent
5fab66444f
commit
7f971e8549
73 changed files with 2098 additions and 1048 deletions
|
@ -11,20 +11,30 @@ public class Application : BaseModel
|
|||
public required string[] Scopes { get; init; }
|
||||
public required string[] RedirectUris { get; init; }
|
||||
|
||||
public static Application Create(ISnowflakeGenerator snowflakeGenerator, string name, string[] scopes,
|
||||
string[] redirectUrls)
|
||||
public static Application Create(
|
||||
ISnowflakeGenerator snowflakeGenerator,
|
||||
string name,
|
||||
string[] scopes,
|
||||
string[] redirectUrls
|
||||
)
|
||||
{
|
||||
var clientId = RandomNumberGenerator.GetHexString(32, true);
|
||||
var clientSecret = AuthUtils.RandomToken();
|
||||
|
||||
if (scopes.Except(AuthUtils.ApplicationScopes).Any())
|
||||
{
|
||||
throw new ArgumentException("Invalid scopes passed to Application.Create", nameof(scopes));
|
||||
throw new ArgumentException(
|
||||
"Invalid scopes passed to Application.Create",
|
||||
nameof(scopes)
|
||||
);
|
||||
}
|
||||
|
||||
if (redirectUrls.Any(s => !AuthUtils.ValidateRedirectUri(s)))
|
||||
{
|
||||
throw new ArgumentException("Invalid redirect URLs passed to Application.Create", nameof(redirectUrls));
|
||||
throw new ArgumentException(
|
||||
"Invalid redirect URLs passed to Application.Create",
|
||||
nameof(redirectUrls)
|
||||
);
|
||||
}
|
||||
|
||||
return new Application
|
||||
|
@ -34,7 +44,7 @@ public class Application : BaseModel
|
|||
ClientSecret = clientSecret,
|
||||
Name = name,
|
||||
Scopes = scopes,
|
||||
RedirectUris = redirectUrls
|
||||
RedirectUris = redirectUrls,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@ public enum AuthType
|
|||
Tumblr,
|
||||
Fediverse,
|
||||
Email,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ public class FediverseApplication : BaseModel
|
|||
public enum FediverseInstanceType
|
||||
{
|
||||
MastodonApi,
|
||||
MisskeyApi
|
||||
}
|
||||
MisskeyApi,
|
||||
}
|
||||
|
|
|
@ -15,4 +15,4 @@ public class FieldEntry
|
|||
public class Pronoun : FieldEntry
|
||||
{
|
||||
public string? DisplayText { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,4 +18,4 @@ public class Member : BaseModel
|
|||
|
||||
public Snowflake UserId { get; init; }
|
||||
public User User { get; init; } = null!;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,4 @@ public class MemberFlag
|
|||
public required Snowflake MemberId { get; init; }
|
||||
public required Snowflake PrideFlagId { get; init; }
|
||||
public PrideFlag PrideFlag { get; init; } = null!;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,4 @@ public class TemporaryKey
|
|||
public required string Key { get; init; }
|
||||
public required string Value { get; set; }
|
||||
public Instant Expires { get; init; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,4 @@ public class Token : BaseModel
|
|||
|
||||
public Snowflake ApplicationId { get; set; }
|
||||
public Application Application { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,9 @@ public class User : BaseModel
|
|||
public bool Deleted { get; set; }
|
||||
public Instant? DeletedAt { get; set; }
|
||||
public Snowflake? DeletedBy { get; set; }
|
||||
[NotMapped] public bool? SelfDelete => Deleted ? DeletedBy != null : null;
|
||||
|
||||
[NotMapped]
|
||||
public bool? SelfDelete => Deleted ? DeletedBy != null : null;
|
||||
|
||||
public class CustomPreference
|
||||
{
|
||||
|
@ -69,4 +71,4 @@ public enum PreferenceSize
|
|||
public class UserSettings
|
||||
{
|
||||
public bool? DarkMode { get; set; } = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue