Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
BE: code formatting with eslint
Browse files Browse the repository at this point in the history
Signed-off-by: Jozys <joshua@slaar.de>
  • Loading branch information
Jozys committed May 11, 2024
1 parent 1fe1b36 commit 7ee7d32
Show file tree
Hide file tree
Showing 16 changed files with 205 additions and 192 deletions.
10 changes: 7 additions & 3 deletions backend/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { Body, Controller, Get, Post, Req, Res} from '@nestjs/common';
import { Body, Controller, Get, Post, Req, Res } from '@nestjs/common';
import { AppService } from './app.service';
import { Prisma, User } from '@prisma/client';
import { AuthService } from './auth/auth.service';
import { UserService } from './database/user/user.service';

@Controller()
export class AppController {
constructor(private readonly appService: AppService, private readonly userService: UserService, private readonly authService: AuthService) { }
constructor(
private readonly appService: AppService,
private readonly userService: UserService,
private readonly authService: AuthService,
) {}

@Get()
getHello(): string {
Expand All @@ -25,7 +29,7 @@ export class AppController {

@Post('user')
async createUser(@Body() user: Prisma.UserCreateInput): Promise<User> {
return this.userService.createUser(user);
return this.userService.createUser(user);
}

@Get('user')
Expand Down
2 changes: 1 addition & 1 deletion backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { AuthMiddleware } from './middleware/auth/auth.middleware';
imports: [ConfigModule.forRoot()],
controllers: [AppController],
providers: [
AppService,
AppService,
AuthService,
PrismaService,
UserService,
Expand Down
34 changes: 18 additions & 16 deletions backend/src/database/blacklist/blacklist.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ import { PrismaService } from '../prisma.service';

@Injectable()
export class BlacklistService {
constructor(private prisma: PrismaService) { }
constructor(private prisma: PrismaService) {}

async createBlacklistItem(data: Prisma.BlacklistCreateInput): Promise<Blacklist> {
return this.prisma.blacklist.create({
data,
})
}
async createBlacklistItem(
data: Prisma.BlacklistCreateInput,
): Promise<Blacklist> {
return this.prisma.blacklist.create({
data,
});
}

async getBlacklistItem(
blacklistWhereUniqueInput: Prisma.BlacklistWhereUniqueInput,
): Promise<Blacklist | null> {
return this.prisma.blacklist.findUnique({
where: blacklistWhereUniqueInput,
});
}
async getBlacklistItem(
blacklistWhereUniqueInput: Prisma.BlacklistWhereUniqueInput,
): Promise<Blacklist | null> {
return this.prisma.blacklist.findUnique({
where: blacklistWhereUniqueInput,
});
}

async getAllBlacklistItems(): Promise<Blacklist[]> {
return this.prisma.blacklist.findMany();
}
async getAllBlacklistItems(): Promise<Blacklist[]> {
return this.prisma.blacklist.findMany();
}
}
26 changes: 13 additions & 13 deletions backend/src/database/expert/expert.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { PrismaService } from '../prisma.service';

@Injectable()
export class ExpertService {
constructor(private prisma: PrismaService) { }
constructor(private prisma: PrismaService) {}

async createExpert(data: Prisma.ExpertCreateInput): Promise<Expert> {
return this.prisma.expert.create({
data,
})
}
async createExpert(data: Prisma.ExpertCreateInput): Promise<Expert> {
return this.prisma.expert.create({
data,
});
}

async getExpert(
expertWhereUniqueInput: Prisma.ExpertWhereUniqueInput,
): Promise<Expert | null> {
return this.prisma.expert.findUnique({
where: expertWhereUniqueInput,
});
}
async getExpert(
expertWhereUniqueInput: Prisma.ExpertWhereUniqueInput,
): Promise<Expert | null> {
return this.prisma.expert.findUnique({
where: expertWhereUniqueInput,
});
}
}
26 changes: 13 additions & 13 deletions backend/src/database/favorite/favorite.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { PrismaService } from '../prisma.service';

@Injectable()
export class FavoriteService {
constructor(private prisma: PrismaService) { }
constructor(private prisma: PrismaService) {}

async createFavorite(data: Prisma.FavoriteCreateInput): Promise<Favorite> {
return this.prisma.favorite.create({
data,
})
}
async createFavorite(data: Prisma.FavoriteCreateInput): Promise<Favorite> {
return this.prisma.favorite.create({
data,
});
}

async getFavorite(
favoriteWhereUniqueInput: Prisma.FavoriteWhereUniqueInput,
): Promise<Favorite | null> {
return this.prisma.favorite.findUnique({
where: favoriteWhereUniqueInput,
});
}
async getFavorite(
favoriteWhereUniqueInput: Prisma.FavoriteWhereUniqueInput,
): Promise<Favorite | null> {
return this.prisma.favorite.findUnique({
where: favoriteWhereUniqueInput,
});
}
}
28 changes: 15 additions & 13 deletions backend/src/database/login-attempt/login-attempt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import { LoginAttempt, Prisma } from '@prisma/client';

@Injectable()
export class LoginAttemptService {
constructor(private prisma: PrismaService) { }
constructor(private prisma: PrismaService) {}

async createLoginAttempt(data: Prisma.LoginAttemptCreateInput): Promise<LoginAttempt> {
return this.prisma.loginAttempt.create({
data,
})
}
async createLoginAttempt(
data: Prisma.LoginAttemptCreateInput,
): Promise<LoginAttempt> {
return this.prisma.loginAttempt.create({
data,
});
}

async getLoginAttempt(
loginAttemptWhereUniqueInput: Prisma.LoginAttemptWhereUniqueInput,
): Promise<LoginAttempt | null> {
return this.prisma.loginAttempt.findUnique({
where: loginAttemptWhereUniqueInput,
});
}
async getLoginAttempt(
loginAttemptWhereUniqueInput: Prisma.LoginAttemptWhereUniqueInput,
): Promise<LoginAttempt | null> {
return this.prisma.loginAttempt.findUnique({
where: loginAttemptWhereUniqueInput,
});
}
}
28 changes: 15 additions & 13 deletions backend/src/database/moderation/moderation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import { Moderation, Prisma } from '@prisma/client';

@Injectable()
export class ModerationService {
constructor(private prisma: PrismaService) { }
constructor(private prisma: PrismaService) {}

async createModeration(data: Prisma.ModerationCreateInput): Promise<Moderation> {
return this.prisma.moderation.create({
data,
})
}
async createModeration(
data: Prisma.ModerationCreateInput,
): Promise<Moderation> {
return this.prisma.moderation.create({
data,
});
}

async getModeration(
moderationWhereUniqueInput: Prisma.ModerationWhereUniqueInput,
): Promise<Moderation | null> {
return this.prisma.moderation.findUnique({
where: moderationWhereUniqueInput,
});
}
async getModeration(
moderationWhereUniqueInput: Prisma.ModerationWhereUniqueInput,
): Promise<Moderation | null> {
return this.prisma.moderation.findUnique({
where: moderationWhereUniqueInput,
});
}
}
2 changes: 1 addition & 1 deletion backend/src/database/prisma.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit() {
await this.$connect();
}
}
}
26 changes: 13 additions & 13 deletions backend/src/database/quest/quest.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { Prisma, Quest } from '@prisma/client';

@Injectable()
export class QuestService {
constructor(private prisma: PrismaService) { }
constructor(private prisma: PrismaService) {}

async createQuest(data: Prisma.QuestCreateInput): Promise<Quest> {
return this.prisma.quest.create({
data,
})
}
async createQuest(data: Prisma.QuestCreateInput): Promise<Quest> {
return this.prisma.quest.create({
data,
});
}

async getQuest(
questWhereUniqueInput: Prisma.QuestWhereUniqueInput,
): Promise<Quest | null> {
return this.prisma.quest.findUnique({
where: questWhereUniqueInput,
});
}
async getQuest(
questWhereUniqueInput: Prisma.QuestWhereUniqueInput,
): Promise<Quest | null> {
return this.prisma.quest.findUnique({
where: questWhereUniqueInput,
});
}
}
26 changes: 13 additions & 13 deletions backend/src/database/tag/tag.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { Prisma, Tag } from '@prisma/client';

@Injectable()
export class TagService {
constructor(private prisma: PrismaService) { }
constructor(private prisma: PrismaService) {}

async createTag(data: Prisma.TagCreateInput): Promise<Tag> {
return this.prisma.tag.create({
data,
})
}
async createTag(data: Prisma.TagCreateInput): Promise<Tag> {
return this.prisma.tag.create({
data,
});
}

async getTag(
tagWhereUniqueInput: Prisma.TagWhereUniqueInput,
): Promise<Tag | null> {
return this.prisma.tag.findUnique({
where: tagWhereUniqueInput,
});
}
async getTag(
tagWhereUniqueInput: Prisma.TagWhereUniqueInput,
): Promise<Tag | null> {
return this.prisma.tag.findUnique({
where: tagWhereUniqueInput,
});
}
}
82 changes: 42 additions & 40 deletions backend/src/database/user-content/user-content.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,52 @@ import { PrismaService } from '../prisma.service';

@Injectable()
export class UserContentService {
constructor(private prisma: PrismaService) { }
constructor(private prisma: PrismaService) {}

// Question
async createQuestion(data: Prisma.QuestionCreateInput): Promise<Question> {
return this.prisma.question.create({
data,
})
}
// Question
async createQuestion(data: Prisma.QuestionCreateInput): Promise<Question> {
return this.prisma.question.create({
data,
});
}

async getQuestion(
questionWhereUniqueInput: Prisma.QuestionWhereUniqueInput,
): Promise<Question | null> {
return this.prisma.question.findUnique({
where: questionWhereUniqueInput,
});
}
async getQuestion(
questionWhereUniqueInput: Prisma.QuestionWhereUniqueInput,
): Promise<Question | null> {
return this.prisma.question.findUnique({
where: questionWhereUniqueInput,
});
}

// Answer
async createAnswer(data: Prisma.AnswerCreateInput): Promise<Answer> {
return this.prisma.answer.create({
data,
})
}
// Answer
async createAnswer(data: Prisma.AnswerCreateInput): Promise<Answer> {
return this.prisma.answer.create({
data,
});
}

async getAnswer(
answerWhereUniqueInput: Prisma.AnswerWhereUniqueInput,
): Promise<Answer | null> {
return this.prisma.answer.findUnique({
where: answerWhereUniqueInput,
});
}
async getAnswer(
answerWhereUniqueInput: Prisma.AnswerWhereUniqueInput,
): Promise<Answer | null> {
return this.prisma.answer.findUnique({
where: answerWhereUniqueInput,
});
}

// Discussion
async createDiscussion(data: Prisma.DiscussionCreateInput): Promise<Discussion> {
return this.prisma.discussion.create({
data,
})
}
// Discussion
async createDiscussion(
data: Prisma.DiscussionCreateInput,
): Promise<Discussion> {
return this.prisma.discussion.create({
data,
});
}

async getDiscussion(
discussionWhereUniqueInput: Prisma.DiscussionWhereUniqueInput,
): Promise<Discussion | null> {
return this.prisma.discussion.findUnique({
where: discussionWhereUniqueInput,
});
}
async getDiscussion(
discussionWhereUniqueInput: Prisma.DiscussionWhereUniqueInput,
): Promise<Discussion | null> {
return this.prisma.discussion.findUnique({
where: discussionWhereUniqueInput,
});
}
}
Loading

0 comments on commit 7ee7d32

Please sign in to comment.