Skip to content

Commit 84f0e58

Browse files
authored
Merge pull request #301 from authenticeasy-sys/main
push code update
2 parents 9bc94d9 + cd0e44c commit 84f0e58

File tree

8 files changed

+243
-0
lines changed

8 files changed

+243
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Controller, Get } from '@nestjs/common';
2+
import { AppService } from './app.service';
3+
4+
@Controller()
5+
export class AppController {
6+
constructor(private readonly appService: AppService) {}
7+
8+
@Get()
9+
getHello(): string {
10+
return this.appService.getHello();
11+
}
12+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Test, TestingModule } from '@nestjs/testing';
2+
import { AppController } from './app.controller';
3+
import { AppService } from './app.service';
4+
5+
describe('AppController', () => {
6+
let appController: AppController;
7+
8+
beforeEach(async () => {
9+
const app: TestingModule = await Test.createTestingModule({
10+
controllers: [AppController],
11+
providers: [AppService],
12+
}).compile();
13+
14+
appController = app.get<AppController>(AppController);
15+
});
16+
17+
describe('root', () => {
18+
it('should return "Hello World!"', () => {
19+
expect(appController.getHello()).toBe('Hello World!');
20+
});
21+
});
22+
});
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import { Module } from '@nestjs/common';
2+
import { AppController } from './app.controller';
3+
import { AppService } from './app.service';
4+
import { TutorAccountSettingsModule } from './tutor-account-settings/tutor-account-settings.module';
5+
import { StudentAccountSettingsModule } from './student-account-settings/student-account-settings.module';
6+
import { AdminModeratorAccountSettingsModule } from './admin-moderator-account-settings/admin-moderator-account-settings.module';
7+
import { AdminAuthModule } from './admin-auth/admin-auth.module';
8+
import { CoursePerformanceLeaderboardModule } from './course-performance-leaderboard/course-performance-leaderboard.module';
9+
import { CourseCategorizationFilteringModule } from './course-categorization-filtering/course-categorization-filtering.module';
10+
import { PrivateTutoringBookingsModule } from './private-tutoring-bookings/private-tutoring-bookings.module';
11+
import { GamificationPointsModule } from './gamification-points/gamification-points.module';
12+
import { CourseCertificationNftAchievementsModule } from './course-certification-nft-achievements/course-certification-nft-achievements.module';
13+
import { CourseRatingsFeedbackModule } from './course-ratings-feedback/course-ratings-feedback.module';
14+
import { TutorJwtAuthModule } from './tutor-jwt-auth/tutor-jwt-auth.module';
15+
import { StudentWishlistModule } from './student-wishlist/student-wishlist.module';
16+
import { FaqManagementModule } from './faq-management/faq-management.module';
17+
import { TermsConditionsManagementModule } from './terms-conditions-management/terms-conditions-management.module';
18+
import { PrivacyPolicyManagementModule } from './privacy-policy-management/privacy-policy-management.module';
19+
import { TutorReportsAnalyticsModule } from './tutor-reports-analytics/tutor-reports-analytics.module';
20+
import { StudentReportsAnalyticsModule } from './student-reports-analytics/student-reports-analytics.module';
21+
import { CourseReportsAnalyticsModule } from './course-reports-analytics/course-reports-analytics.module';
22+
import { CertificateSocialSharingModule } from './certificate-social-sharing/certificate-social-sharing.module';
23+
import { CertificateDownloadModule } from './certificate-download/certificate-download.module';
24+
import { AdminCertificateNameChangeReviewModule } from './admin-certificate-name-change-review/admin-certificate-name-change-review.module';
25+
import { StudentCertificateNameChangeRequestModule } from './student-certificate-name-change-request/student-certificate-name-change-request.module';
26+
import { AdminFinancialAidManagementModule } from './admin-financial-aid-management/admin-financial-aid-management.module';
27+
import { StudentFinancialAidApplicationModule } from './student-financial-aid-application/student-financial-aid-application.module';
28+
import { AboutManagementModule } from './about-management/about-management.module';
29+
import { ContactMessageModule } from './contact-message/contact-message.module';
30+
import { BadgesNftModule } from './badges-nft/badges-nft.module';
31+
import { NotificationSystemModule } from './notification-system/notification-system.module';
32+
import { OrganizationManagementModule } from './organization-management/organization-management.module';
33+
import { OrganizationMembersModule } from './organization-members/organization-members.module';
34+
import { PointsManagementModule } from './points-management/points-management.module';
35+
import { RemovalRequestModule } from './removal-request/removal-request.module';
36+
import { ReportAbuseModule } from './report-abuse/report-abuse.module';
37+
import { SessionManagementModule } from './session-management/session-management.module';
38+
import { SubscriptionPlanManagementModule } from './subscription-plan-management/subscription-plan-management.module';
39+
import { StudentAuthModule } from './student-auth/student-auth.module';
40+
import { StudentCartModule } from './student-cart/student-cart.module';
41+
import { GoogleAuthModule } from './google-auth/google-auth.module';
42+
import { StudentSavedCoursesModule } from './student-saved-courses/student-saved-courses.module';
43+
import { AdminCourseManagementModule } from './admin-course-management/admin-course-management.module';
44+
45+
@Module({
46+
imports: [
47+
TutorAccountSettingsModule,
48+
StudentAccountSettingsModule,
49+
AdminModeratorAccountSettingsModule,
50+
AdminAuthModule,
51+
CoursePerformanceLeaderboardModule,
52+
CourseCategorizationFilteringModule,
53+
PrivateTutoringBookingsModule,
54+
GamificationPointsModule,
55+
CourseCertificationNftAchievementsModule,
56+
CourseRatingsFeedbackModule,
57+
TutorJwtAuthModule,
58+
StudentWishlistModule,
59+
FaqManagementModule,
60+
TermsConditionsManagementModule,
61+
PrivacyPolicyManagementModule,
62+
TutorReportsAnalyticsModule,
63+
StudentReportsAnalyticsModule,
64+
CourseReportsAnalyticsModule,
65+
CertificateSocialSharingModule,
66+
CertificateDownloadModule,
67+
AdminCertificateNameChangeReviewModule,
68+
StudentCertificateNameChangeRequestModule,
69+
AdminFinancialAidManagementModule,
70+
StudentFinancialAidApplicationModule,
71+
AboutManagementModule,
72+
ContactMessageModule,
73+
BadgesNftModule,
74+
NotificationSystemModule,
75+
OrganizationManagementModule,
76+
OrganizationMembersModule,
77+
PointsManagementModule,
78+
RemovalRequestModule,
79+
ReportAbuseModule,
80+
SessionManagementModule,
81+
SubscriptionPlanManagementModule,
82+
StudentAuthModule,
83+
StudentCartModule,
84+
GoogleAuthModule,
85+
StudentSavedCoursesModule,
86+
AdminCourseManagementModule,
87+
],
88+
controllers: [AppController],
89+
providers: [AppService],
90+
})
91+
export class AppModule {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Injectable } from '@nestjs/common';
2+
3+
@Injectable()
4+
export class AppService {
5+
getHello(): string {
6+
return 'Hello World!';
7+
}
8+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
2+
import { CertificateDownloadService } from './certificate-download.service';
3+
import { CreateCertificateDownloadDto } from './dto/create-certificate-download.dto';
4+
import { UpdateCertificateDownloadDto } from './dto/update-certificate-download.dto';
5+
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
6+
import { RolesGuard } from '../common/guards/roles.guard';
7+
import { Role } from '../common/enums/role.enum';
8+
import { Roles } from '../common/decorators/roles.decorator';
9+
10+
@Controller('certificates/download')
11+
export class CertificateDownloadController {
12+
constructor(private readonly service: CertificateDownloadService) {}
13+
14+
@Get()
15+
findAll() {
16+
return this.service.findAll();
17+
}
18+
19+
@Get(':id')
20+
findOne(@Param('id') id: string) {
21+
return this.service.findOne(id);
22+
}
23+
24+
@Post()
25+
@UseGuards(JwtAuthGuard, RolesGuard)
26+
@Roles(Role.ADMIN, Role.MODERATOR, Role.TUTOR)
27+
create(@Body() payload: CreateCertificateDownloadDto) {
28+
return this.service.create(payload);
29+
}
30+
31+
@Patch(':id')
32+
@UseGuards(JwtAuthGuard, RolesGuard)
33+
@Roles(Role.ADMIN, Role.MODERATOR, Role.TUTOR)
34+
update(@Param('id') id: string, @Body() payload: UpdateCertificateDownloadDto) {
35+
return this.service.update(id, payload);
36+
}
37+
38+
@Delete(':id')
39+
@UseGuards(JwtAuthGuard, RolesGuard)
40+
@Roles(Role.ADMIN, Role.MODERATOR)
41+
remove(@Param('id') id: string) {
42+
return this.service.remove(id);
43+
}
44+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Module } from '@nestjs/common';
2+
import { CertificateDownloadController } from './certificate-download.controller';
3+
import { CertificateDownloadService } from './certificate-download.service';
4+
5+
@Module({
6+
controllers: [CertificateDownloadController],
7+
providers: [CertificateDownloadService],
8+
})
9+
export class CertificateDownloadModule {}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { Injectable, NotFoundException } from '@nestjs/common';
2+
import { CreateCertificateDownloadDto } from './dto/create-certificate-download.dto';
3+
import { UpdateCertificateDownloadDto } from './dto/update-certificate-download.dto';
4+
5+
@Injectable()
6+
export class CertificateDownloadService {
7+
private readonly items: Array<{ id: string } & CreateCertificateDownloadDto> = [];
8+
9+
findAll() {
10+
return this.items;
11+
}
12+
13+
findOne(id: string) {
14+
const item = this.items.find((entry) => entry.id === id);
15+
if (!item) {
16+
throw new NotFoundException('CertificateDownload item not found');
17+
}
18+
return item;
19+
}
20+
21+
create(payload: CreateCertificateDownloadDto) {
22+
const created = { id: crypto.randomUUID(), ...payload };
23+
this.items.push(created);
24+
return created;
25+
}
26+
27+
update(id: string, payload: UpdateCertificateDownloadDto) {
28+
const item = this.findOne(id);
29+
Object.assign(item, payload);
30+
return item;
31+
}
32+
33+
remove(id: string) {
34+
const index = this.items.findIndex((entry) => entry.id === id);
35+
if (index === -1) {
36+
throw new NotFoundException('CertificateDownload item not found');
37+
}
38+
this.items.splice(index, 1);
39+
return { id, deleted: true };
40+
}
41+
}

benches/src/scrap-menu/main.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { ValidationPipe } from '@nestjs/common';
2+
import { NestFactory } from '@nestjs/core';
3+
import { AppModule } from './app.module';
4+
5+
async function bootstrap() {
6+
const app = await NestFactory.create(AppModule);
7+
app.useGlobalPipes(
8+
new ValidationPipe({
9+
whitelist: true,
10+
forbidNonWhitelisted: false,
11+
transform: true,
12+
}),
13+
);
14+
await app.listen(process.env.PORT ?? 3000);
15+
}
16+
bootstrap();

0 commit comments

Comments
 (0)