Skip to content

Commit

Permalink
Update import order in server.ts
Browse files Browse the repository at this point in the history
fixed Cannot read properties of null (reading 'prefix')
  • Loading branch information
appujet committed Apr 14, 2024
1 parent 5ff80a3 commit e2a9d1e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/database/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import { PrismaClient, Guild, Playlist, Dj, Role, Botchannel, Setup, Stay, Song, } from '@prisma/client';
import { Botchannel, Dj, Guild, Playlist, PrismaClient, Role, Setup, Song, Stay, } from '@prisma/client';

import config from '../config.js';

export default class ServerData {
Expand All @@ -10,19 +11,19 @@ export default class ServerData {
}

public async get(guildId: string): Promise<Guild | null> {
const data = await this.prisma.guild.findUnique({
let data = await this.prisma.guild.findUnique({
where: {
guildId,
},
});
if (!data) {
await this.prisma.guild.create({
data = await this.prisma.guild.create({
data: {
guildId,
prefix: config.prefix,
},
});
return null;
return data;
}
return data;
}
Expand Down

0 comments on commit e2a9d1e

Please sign in to comment.