Skip to content

Commit

Permalink
edit returns
Browse files Browse the repository at this point in the history
  • Loading branch information
Szotkowski committed Sep 10, 2023
1 parent 1982f2c commit 724b78e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/controllers/instruction-step.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class InstructionStepController {
},
})
step: Omit<Step, 'id' | 'instructionId'>,
): Promise<boolean> {
): Promise<Step> {
const user = await this.userRepository.findById(this.user.id);
if (!user) {
throw new HttpErrors.NotFound('User not found');
Expand All @@ -88,11 +88,11 @@ export class InstructionStepController {
throw new HttpErrors.NotFound('Instruction not found');
}
this.validateInstructionOwnership(instruction);
await this.stepRepository.create({
const newStep = await this.stepRepository.create({
...step,
instructionId: instructionId,
});
return true;
return newStep;
}

@authenticate('jwt')
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/user-instruction.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ export class UserInstructionController {
Instruction,
'id' | 'userId' | 'date' | 'link' | 'deleteHash' | 'premium'
>,
): Promise<boolean> {
): Promise<Instruction> {
const user = await this.userRepository.findById(this.user.id);
if (!user) {
throw new HttpErrors.NotFound('User not found');
}
await this.instructionRepository.create({
const newInstruction = await this.instructionRepository.create({
...instruction,
userId: this.user.id,
});
return true;
return newInstruction;
}

@authenticate('jwt')
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/user-link.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export class UserLinkController {
@repository(UserRepository) public userRepository: UserRepository,
@repository(UserLinkRepository)
public userLinkRepository: UserLinkRepository,
) {}
) { }

@authenticate('jwt')
@post('/users/{id}//follow/{followeeId}')
@post('/users/{id}/follow/{followeeId}')
async followUser(
@param.path.number('followeeId') followeeId: number,
): Promise<boolean> {
Expand All @@ -39,7 +39,7 @@ export class UserLinkController {
}

@authenticate('jwt')
@del('/users/{id}//unfollow/{followeeId}')
@del('/users/{id}/unfollow/{followeeId}')
async unfollowUser(
@param.path.number('followeeId') followeeId: number,
): Promise<boolean> {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ export class UserController {
return usernamesAndLinks;
}

@get('/user-detail', {
@get('/user-detail/{id}', {
responses: {
'200': {
description: 'Get user detail',
Expand Down

0 comments on commit 724b78e

Please sign in to comment.