This commit is contained in:
parent
dc9963c7fb
commit
084b8aea79
3 changed files with 6 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
import {ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder} from "discord.js";
|
||||
import Moon from "../../../database/entities/Moon";
|
||||
import EmbedColours from "../../../constants/EmbedColours";
|
||||
import MoonValues from "../../../constants/MoonValues";
|
||||
import MoonConstants from "../../../constants/MoonConstants";
|
||||
|
||||
export default async function ListMoons(interaction: CommandInteraction) {
|
||||
const user = interaction.options.get("user")?.user ?? interaction.user;
|
||||
|
@ -14,7 +14,7 @@ export default async function ListMoons(interaction: CommandInteraction) {
|
|||
return;
|
||||
}
|
||||
|
||||
const totalPages = Math.ceil(moons[1] / MoonValues.ListPageLength);
|
||||
const totalPages = Math.ceil(moons[1] / MoonConstants.ListPageLength);
|
||||
|
||||
const description = moons[0].flatMap(x => `${x.MoonNumber}. ${x.Description.slice(0, 15)}`);
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export default class MoonValues {
|
||||
export default class MoonConstants {
|
||||
public static readonly ListPageLength = 10;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import { Column, Entity } from "typeorm";
|
||||
import BaseEntity from "../../contracts/BaseEntity";
|
||||
import AppDataSource from "../dataSources/appDataSource";
|
||||
import MoonValues from "../../constants/MoonValues";
|
||||
import MoonConstants from "../../constants/MoonConstants";
|
||||
|
||||
@Entity()
|
||||
export default class Moon extends BaseEntity {
|
||||
|
@ -31,7 +31,7 @@ export default class Moon extends BaseEntity {
|
|||
}
|
||||
|
||||
public static async FetchPaginatedMoonsByUserId(userId: string, page: number): Promise<[ Moon[], number ]> {
|
||||
const rangeStart = page * MoonValues.ListPageLength;
|
||||
const rangeStart = page * MoonConstants.ListPageLength;
|
||||
|
||||
const repository = AppDataSource.getRepository(Moon);
|
||||
|
||||
|
@ -39,7 +39,7 @@ export default class Moon extends BaseEntity {
|
|||
where: { UserId: userId },
|
||||
order: { MoonNumber: "ASC" },
|
||||
skip: rangeStart,
|
||||
take: MoonValues.ListPageLength,
|
||||
take: MoonConstants.ListPageLength,
|
||||
});
|
||||
|
||||
return moons;
|
||||
|
|
Loading…
Reference in a new issue