Skip to content

Commit

Permalink
fix: add missing ApiProperty decorator to patchExternalSettings endpo…
Browse files Browse the repository at this point in the history
…int (#1670)
  • Loading branch information
Junjiequan authored Jan 28, 2025
1 parent 1a82a2c commit 8ac01ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/samples/schemas/sample.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ export type SampleDocument = SampleClass & Document;
timestamps: true,
})
export class SampleClass extends OwnableClass {
@ApiHideProperty()
@Prop({ type: String })
_id: string;

/**
* Globally unique identifier of a sample. This could be provided as an input value or generated by the system.
*/
@Prop({ type: String, unique: true, required: true, default: () => uuidv4() })
sampleId: string;

@ApiHideProperty()
@Prop({ type: String })
_id: string;

/**
* The owner of the sample.
*/
Expand Down
13 changes: 12 additions & 1 deletion src/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ApiBearerAuth,
ApiBody,
ApiOperation,
ApiParam,
ApiResponse,
ApiTags,
} from "@nestjs/swagger";
Expand Down Expand Up @@ -304,11 +305,21 @@ export class UsersController {
ability.can(Action.UserUpdateOwn, User) ||
ability.can(Action.UserUpdateAny, User),
)
@ApiParam({ name: "id", type: String, description: "User ID" })
@ApiBody({
schema: {
type: "object",
additionalProperties: true,
example: { field: "setting" },
description:
"External settings to update. This should be a key-value pair object containing the settings to modify.",
},
})
@Patch("/:id/settings/external")
async patchExternalSettings(
@Req() request: Request,
@Param("id") id: string,
@Body() externalSettings: Record<string, unknown>,
@Body() externalSettings = {},
): Promise<UserSettings | null> {
await this.checkUserAuthorization(
request,
Expand Down

0 comments on commit 8ac01ba

Please sign in to comment.