Skip to content

Commit

Permalink
fix(scheduler): user is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
NedcloarBR committed Sep 1, 2024
1 parent af331dd commit 5be3245
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/modules/database/repositories/Guild.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export class GuildRepository implements IGuildRepository {
});
}

public async create(guild: Guild): Promise<{ callback: void | GuildEntity; status: DatabaseStatus }> {
public async create(
guild: Guild,
): Promise<{ callback: void | GuildEntity; status: DatabaseStatus }> {
let status = DatabaseStatus.Created;
const callback = await this.prisma.guild
.create({
Expand Down
4 changes: 1 addition & 3 deletions src/modules/database/repositories/Repositories.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { Repositories } from "../types/constants";
import { GuildRepository } from "./Guild.repository";
import { UserRepository } from "./User.repository";

const providers: Provider<
GuildRepository | UserRepository
>[] = [
const providers: Provider<GuildRepository | UserRepository>[] = [
{
provide: Repositories.Guild,
useClass: GuildRepository,
Expand Down
7 changes: 5 additions & 2 deletions src/modules/database/repositories/User.repository.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Logger } from "@nestjs/common";
import { Injectable, Logger } from "@nestjs/common";
import { Prisma } from "@prisma/client";
import { DefaultArgs } from "@prisma/client/runtime/library";
import { User } from "discord.js";
Expand All @@ -7,6 +7,7 @@ import { UserEntity } from "../entities";
import { DatabaseStatus } from "../types";
import { IUserRepository } from "./interfaces";

@Injectable()
export class UserRepository implements IUserRepository {
public constructor(private readonly prisma: PrismaService) {}

Expand Down Expand Up @@ -35,7 +36,9 @@ export class UserRepository implements IUserRepository {
});
}

public async create(user: User): Promise<{ callback: UserEntity | void; status: DatabaseStatus }> {
public async create(
user: User,
): Promise<{ callback: UserEntity | void; status: DatabaseStatus }> {
let status = DatabaseStatus.Created;
const callback = await this.prisma.user
.create({
Expand Down
4 changes: 1 addition & 3 deletions src/modules/schedule/schedule.service.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Services } from "@/types/Constants";
import { Inject, Injectable, Logger } from "@nestjs/common";
import { Cron, CronExpression, Timeout } from "@nestjs/schedule";
import { PrismaService } from "nestjs-prisma";
import { IDatabaseService } from "../database/interfaces/IDatabaseService";
import type { IDatabaseService } from "../database/interfaces/IDatabaseService";

@Injectable()
export class ScheduleService {
public constructor(
@Inject(Services.Database) private readonly database: IDatabaseService,
private readonly prisma: PrismaService,
) {}

private readonly logger = new Logger(ScheduleService.name);
Expand Down

0 comments on commit 5be3245

Please sign in to comment.