49 lines
1.0 KiB
C#
49 lines
1.0 KiB
C#
using OwnChar.Data.Model.Client;
|
|
using OwnChar.Server.Data.Model;
|
|
|
|
namespace OwnChar.Server.Extensions;
|
|
|
|
public static class ModelExtensions
|
|
{
|
|
public static Group ToClient(this GroupDb @this)
|
|
{
|
|
return new()
|
|
{
|
|
Id = @this.Id,
|
|
Name = @this.Name,
|
|
Fandom = @this.Fandom,
|
|
IsInternal = @this.IsInternal,
|
|
};
|
|
}
|
|
|
|
public static UserAccount ToClient(this UserAccountDb @this)
|
|
{
|
|
return new()
|
|
{
|
|
Id = @this.Id,
|
|
Email = @this.Email,
|
|
Type = @this.Type,
|
|
Username = @this.Username,
|
|
};
|
|
}
|
|
|
|
public static UserProfile ToClient(this UserProfileDb @this)
|
|
{
|
|
return new()
|
|
{
|
|
Id = @this.Id,
|
|
Name = @this.Name,
|
|
};
|
|
}
|
|
|
|
public static MemberEntry ToClient(this MemberEntryDb @this)
|
|
{
|
|
return new()
|
|
{
|
|
Id = @this.Id,
|
|
UserProfileId = @this.User!.Id,
|
|
Level = @this.Level,
|
|
};
|
|
}
|
|
}
|