Fix: No more type casting required, rather take the gernics

This commit is contained in:
Diego Magdaleno
2021-05-23 13:43:38 -05:00
parent 69fce77aef
commit 28424ed950
14 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -362,4 +362,4 @@ const validator = ajv.compile(schema);
const configPath = getConfigPathForFile("fosscord", "api", ".json");
export const apiConfig = new Config({path: configPath, schemaValidator: validator, schema: schema});
export const apiConfig = new Config<DefaultOptions>({path: configPath, schemaValidator: validator, schema: schema});
+1 -1
View File
@@ -39,7 +39,7 @@ export async function isMember(user_id: string, guild_id: string) {
export async function addMember(user_id: string, guild_id: string, cache?: { guild?: GuildDocument }) {
const user = await getPublicUser(user_id, { guilds: true });
const { maxGuilds } = (Config.apiConfig.getAll() as Config.DefaultOptions).limits.user;
const { maxGuilds } = Config.apiConfig.getAll().limits.user;
if (user.guilds.length >= maxGuilds) {
throw new HTTPError(`You are at the ${maxGuilds} server limit.`, 403);
}
+1 -1
View File
@@ -23,7 +23,7 @@ export function check(password: string): number {
minUpperCase,
minSymbols,
blockInsecureCommonPasswords,
} = (Config.apiConfig.getAll() as Config.DefaultOptions).register.password;
} = Config.apiConfig.getAll().register.password;
var strength = 0;
// checks for total password len