diff --git a/src/intervals/memory.ts b/src/intervals/memory.ts index 64adef3..8149b2d 100644 --- a/src/intervals/memory.ts +++ b/src/intervals/memory.ts @@ -2,7 +2,7 @@ /* eslint-disable no-await-in-loop */ import { Client } from '..'; import { RichEmbed } from '../class'; -import { TierInterface } from '../models'; +import { Tiers } from '../models'; const channelID = '691824484230889546'; @@ -18,7 +18,7 @@ export default function memory(client: Client) { // memory in megabytes const memoryConversion = mem / 1024 / 1024; const userLimits: { soft?: number, hard?: number } = {}; - const tier: TierInterface = await client.db.Tier.findOne({ id: acc.tier }).lean().exec(); + const tier: Tiers = await client.db.Tier.findOne({ id: acc.tier }).lean().exec(); userLimits.soft = acc.ramLimitNotification; userLimits.hard = tier.resourceLimits.ram; if ((memoryConversion <= userLimits.soft) && (acc.ramLimitNotification !== 0)) { diff --git a/src/models/Tier.ts b/src/models/Tier.ts index ca9e3cf..7542a50 100644 --- a/src/models/Tier.ts +++ b/src/models/Tier.ts @@ -1,13 +1,15 @@ import { Document, Schema, model } from 'mongoose'; -export interface TierInterface extends Document { +export interface Tiers { id: number, resourceLimits: { - // in MB - ram: number, - // in MB - storage: number, - }, + // In MB + ram: number, storage: number + } +} + +export interface TierInterface extends Tiers, Document { + id: number; } const Tier: Schema = new Schema({ diff --git a/src/models/index.ts b/src/models/index.ts index 6cac9a8..351bbeb 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,4 +1,4 @@ export { default as Account, AccountInterface } from './Account'; export { default as Moderation, ModerationInterface } from './Moderation'; export { default as Domain, DomainInterface } from './Domain'; -export { default as Tier, TierInterface } from './Tier'; +export { default as Tier, TierInterface, Tiers } from './Tier';