All files / src/modules/shared/database database.service.ts

100% Statements 12/12
100% Branches 0/0
100% Functions 6/6
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40                    3x   8x 8x 8x 8x 8x       1x       1x       1x       1x       1x      
import type { IReactionRolesRepository } from "@/modules/bot/reactionRoles/interfaces/IReactionRoleRepository";
import { ReactionRoles } from "@/modules/bot/reactionRoles/types/constants";
import { Inject, Injectable } from "@nestjs/common";
import type { IAsyncLocalStorage } from "./als/interfaces/IAsyncLocalStorage";
import type { IDatabaseService } from "./interfaces/IDatabaseService";
import type { IGuildRepository, IUserRepository } from "./repositories/interfaces";
import type { IAPIUserRepository } from "./repositories/interfaces/IAPIUserRepository";
import { Repositories } from "./types/constants";
 
@Injectable()
export class DatabaseService implements IDatabaseService {
	public constructor(
		@Inject(Repositories.ALS) private readonly als: IAsyncLocalStorage,
		@Inject(Repositories.Guild) private readonly guild: IGuildRepository,
		@Inject(Repositories.User) private readonly user: IUserRepository,
		@Inject(Repositories.APIUser) private readonly apiUser: IAPIUserRepository,
		@Inject(ReactionRoles.Repository) private readonly reactionRoles: IReactionRolesRepository,
	) {}
 
	public AlsRepo(): IAsyncLocalStorage {
		return this.als;
	}
 
	public GuildRepo(): IGuildRepository {
		return this.guild;
	}
 
	public UserRepo(): IUserRepository {
		return this.user;
	}
 
	public APIUserRepo(): IAPIUserRepository {
		return this.apiUser;
	}
 
	public ReactionRolesRepo(): IReactionRolesRepository {
		return this.reactionRoles;
	}
}