add .lean to mongodb queries

This commit is contained in:
Flam3rboy
2021-04-06 04:30:07 +02:00
parent 6b61c86e3f
commit 509394b592
9 changed files with 106 additions and 63 deletions
+3 -35
View File
@@ -1,42 +1,10 @@
import { Activity } from "fosscord-server-util";
import { EmojiSchema } from "./Emoji";
export const ActivitySchema = {
afk: Boolean,
status: String,
$activities: [
{
name: String, // the activity's name
type: Number, // activity type // TODO: check if its between range 0-5
$url: String, // stream url, is validated when type is 1
$created_at: Number, // unix timestamp of when the activity was added to the user's session
$timestamps: {
// unix timestamps for start and/or end of the game
start: Number,
end: Number,
},
$application_id: BigInt, // application id for the game
$details: String,
$State: String,
$emoji: EmojiSchema,
$party: {
$id: String,
$size: [Number], // used to show the party's current and maximum size // TODO: array length 2
},
$assets: {
$large_image: String, // the id for a large asset of the activity, usually a snowflake
$large_text: String, // text displayed when hovering over the large image of the activity
$small_image: String, // the id for a small asset of the activity, usually a snowflake
$small_text: String, // text displayed when hovering over the small image of the activity
},
$secrets: {
$join: String, // the secret for joining a party
$spectate: String, // the secret for spectating a game
$match: String, // the secret for a specific instanced match
},
$instance: Boolean,
flags: BigInt, // activity flags OR d together, describes what the payload includes
},
],
$activities: [Activity],
$since: Number, // unix time (in milliseconds) of when the client went idle, or null if the client is not idle
};
@@ -56,7 +24,7 @@ export interface ActivitySchema {
};
application_id?: bigint; // application id for the game
details?: string;
State?: string;
state?: string;
emoji?: EmojiSchema;
party?: {
id?: string;
+46 -6
View File
@@ -2,32 +2,72 @@ import { ActivitySchema } from "./Activity";
export const IdentifySchema = {
token: String,
intents: BigInt, // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt
$intents: BigInt, // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt
$properties: {
// bruh discord really uses $ in the property key, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key
// bruh discord really uses $ in the property key for bots, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key
$os: String,
$browser: String,
$device: String,
$$os: String,
$$browser: String,
$$device: String,
$browser_user_agent: String,
$browser_version: String,
$os_version: String,
$referrer: String,
$referring_domain: String,
$referrer_current: String,
$referring_domain_current: String,
$release_channel: String,
$client_build_number: Number,
$client_event_source: String,
},
$presence: ActivitySchema,
$compress: Boolean,
$large_threshold: Number,
$shard: [Number],
$guild_subscriptions: Boolean,
$capabilities: Number,
$client_state: {
$guild_hashes: Object,
$highest_last_message_id: BigInt,
$read_state_version: Number,
$user_guild_settings_version: Number,
},
};
export interface IdentifySchema {
token: string;
properties: {
// bruh discord really uses $ in the property key, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key
$$os: string;
$$browser: string;
$$device: string;
os?: string;
browser?: string;
device?: string;
$os?: string;
$browser?: string;
$device?: string;
browser_user_agent?: string;
browser_version?: string;
os_version?: string;
referrer?: string;
referring_domain?: string;
referrer_current?: string;
referring_domain_current?: string;
release_channel?: "stable" | "dev" | "ptb" | "canary";
client_build_number?: number;
client_event_source?: any;
};
intents: bigint; // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt
intents?: bigint; // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt
presence?: ActivitySchema;
compress?: boolean;
large_threshold?: number;
shard?: [number];
guild_subscriptions?: boolean;
capabilities?: number;
client_state?: {
guild_hashes?: any;
highest_last_message_id?: bigint;
read_state_version?: number;
user_guild_settings_version?: number;
};
}