mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-13 06:02:39 +01:00
🐛 fix In() query
This commit is contained in:
parent
dbbed7cbba
commit
9429c5c09a
@ -137,7 +137,7 @@ router.post("/", route({ body: "RegisterSchema" }), async (req: Request, res: Re
|
|||||||
|
|
||||||
if (!register.allowMultipleAccounts) {
|
if (!register.allowMultipleAccounts) {
|
||||||
// TODO: check if fingerprint was eligible generated
|
// TODO: check if fingerprint was eligible generated
|
||||||
const exists = await User.findOne({ where: { fingerprints: In(fingerprint) } });
|
const exists = await User.findOne({ where: { fingerprints: fingerprint } });
|
||||||
|
|
||||||
if (exists) {
|
if (exists) {
|
||||||
throw FieldErrors({
|
throw FieldErrors({
|
||||||
|
@ -132,7 +132,7 @@ router.patch("/", route({ body: "RolePositionUpdateSchema" }), async (req: Reque
|
|||||||
|
|
||||||
await Promise.all(body.map(async (x) => Role.update({ guild_id, id: x.id }, { position: x.position })));
|
await Promise.all(body.map(async (x) => Role.update({ guild_id, id: x.id }, { position: x.position })));
|
||||||
|
|
||||||
const roles = await Role.find({ guild_id, id: In(body.map((x) => x.id)) });
|
const roles = await Role.find({ where: body.map((x) => ({ id: x.id, guild_id })) });
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
roles.map((x) =>
|
roles.map((x) =>
|
||||||
|
@ -106,7 +106,7 @@ export class User extends BaseClass {
|
|||||||
mfa_enabled: boolean; // if multi factor authentication is enabled
|
mfa_enabled: boolean; // if multi factor authentication is enabled
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
created_at: Date = new Date(); // registration date
|
created_at: Date; // registration date
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
verified: boolean; // if the user is offically verified
|
verified: boolean; // if the user is offically verified
|
||||||
@ -127,7 +127,7 @@ export class User extends BaseClass {
|
|||||||
public_flags: string;
|
public_flags: string;
|
||||||
|
|
||||||
@JoinColumn({ name: "relationship_ids" })
|
@JoinColumn({ name: "relationship_ids" })
|
||||||
@OneToMany(() => Relationship, (relationship: Relationship) => relationship.user, { cascade: true })
|
@OneToMany(() => Relationship, (relationship: Relationship) => relationship.from)
|
||||||
relationships: Relationship[];
|
relationships: Relationship[];
|
||||||
|
|
||||||
@JoinColumn({ name: "connected_account_ids" })
|
@JoinColumn({ name: "connected_account_ids" })
|
||||||
@ -146,6 +146,14 @@ export class User extends BaseClass {
|
|||||||
@Column({ type: "simple-json" })
|
@Column({ type: "simple-json" })
|
||||||
settings: UserSettings;
|
settings: UserSettings;
|
||||||
|
|
||||||
|
toPublicUser() {
|
||||||
|
const user: any = {};
|
||||||
|
PublicUserProjection.forEach((x) => {
|
||||||
|
user[x] = this[x];
|
||||||
|
});
|
||||||
|
return user as PublicUser;
|
||||||
|
}
|
||||||
|
|
||||||
static async getPublicUser(user_id: string, opts?: FindOneOptions<User>) {
|
static async getPublicUser(user_id: string, opts?: FindOneOptions<User>) {
|
||||||
const user = await User.findOne(
|
const user = await User.findOne(
|
||||||
{ id: user_id },
|
{ id: user_id },
|
||||||
@ -261,7 +269,7 @@ export class UserFlags extends BitField {
|
|||||||
SYSTEM: BigInt(1) << BigInt(12),
|
SYSTEM: BigInt(1) << BigInt(12),
|
||||||
HAS_UNREAD_URGENT_MESSAGES: BigInt(1) << BigInt(13),
|
HAS_UNREAD_URGENT_MESSAGES: BigInt(1) << BigInt(13),
|
||||||
BUGHUNTER_LEVEL_2: BigInt(1) << BigInt(14),
|
BUGHUNTER_LEVEL_2: BigInt(1) << BigInt(14),
|
||||||
UNDERAGE_DELETED: BigInt(1) << BigInt(15),
|
UNDERAGE_DELETED: BigInt(1) << BigInt(15),
|
||||||
VERIFIED_BOT: BigInt(1) << BigInt(16),
|
VERIFIED_BOT: BigInt(1) << BigInt(16),
|
||||||
EARLY_VERIFIED_BOT_DEVELOPER: BigInt(1) << BigInt(17),
|
EARLY_VERIFIED_BOT_DEVELOPER: BigInt(1) << BigInt(17),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user