Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
"test:watch": "jest --watch",
"test:cov": "jest --coverage --passWithNoTests",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
"test:e2e": "jest --config ./test/jest-e2e.json",
"seed": "ts-node -r tsconfig-paths/register src/seed.ts"
},
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^4.0.2",
"@nestjs/core": "^10.0.0",
"@nestjs/jwt": "^11.0.2",
"@nestjs/mapped-types": "*",
"@nestjs/passport": "^11.0.5",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/throttler": "^6.5.0",
Expand Down Expand Up @@ -96,7 +98,9 @@
"!**/node_modules/**",
"!**/dist/**",
"!**/common/**",
"!**/stubs/**"
"!**/stubs/**",
"!**/enums/**",
"!seed.ts"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node",
Expand Down
4 changes: 4 additions & 0 deletions backend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { envSchema } from '@src/config/env.validation';
import { DBModule } from '@src/db/db.module';
import { UsersModule } from '@src/users/users.module';
import { AuthModule } from '@src/auth/auth.module';
import { ExercisesModule } from '@src/exercises/exercises.module';
import { WorkoutsModule } from '@src/workouts/workouts.module';

@Module({
imports: [
Expand All @@ -24,6 +26,8 @@ import { AuthModule } from '@src/auth/auth.module';
]),
UsersModule,
AuthModule,
ExercisesModule,
WorkoutsModule,
],
controllers: [],
providers: [
Expand Down
3 changes: 2 additions & 1 deletion backend/src/auth/strategies/jwt.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import { JwtPayload } from '../types';
@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor(private readonly configService: ConfigService) {
const secret = configService.getOrThrow<string>(JWT_ACCESS_TOKEN_SECRET);
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration: false,
secretOrKey: configService.getOrThrow<string>(JWT_ACCESS_TOKEN_SECRET),
secretOrKey: secret,
});
}

Expand Down
4 changes: 4 additions & 0 deletions backend/src/common/messages/response-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ export const ResponseMessages = {
User: {
SuccessRegistration: 'Registration success! Please log in!',
SuccessAuthorization: 'Successed login!',
IdNotFound: 'UserId not found!',
},
Auth: {
ExistUser: 'User with this email allready exists!',
WrongCreds: 'Wrong credentials!',
},
Workout: {
NotFound: 'Workout not found',
},
} as const;
3 changes: 3 additions & 0 deletions backend/src/common/messages/validation-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ export const ValidationMessages = {
PasswordWeak:
'Password is too weak. It must have at least 8 characters, 1 uppercase, 1 lowercase, 1 number, and 1 symbol.',
},
Exercise: {
AllReadyExist: 'Exercise with this name already exists',
},
} as const;
Loading