Initial identify rewrite

This commit is contained in:
Madeline
2023-03-13 19:02:52 +11:00
parent bd5f750024
commit f228561f4c
5 changed files with 387 additions and 216 deletions
+7
View File
@@ -482,3 +482,10 @@ export enum ChannelPermissionOverwriteType {
member = 1,
group = 2,
}
export interface DMChannel extends Omit<Channel, "type" | "recipients"> {
type: ChannelType.DM | ChannelType.GROUP_DM;
recipients: Recipient[];
// TODO: probably more props
}
+9
View File
@@ -280,6 +280,15 @@ export class User extends BaseClass {
return user as PublicUser;
}
toPrivateUser() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const user: any = {};
PrivateUserProjection.forEach((x) => {
user[x] = this[x];
});
return user as UserPrivate;
}
static async getPublicUser(user_id: string, opts?: FindOneOptions<User>) {
return await User.findOneOrFail({
where: { id: user_id },