forked from engineering/cloudservices
TS2740
parent
c7fb133a23
commit
3030db18d9
|
@ -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)) {
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in New Issue