diff --git a/classes/ExternalGroupDto.html b/classes/ExternalGroupDto.html index cec43c43d90..4e5fdd55cfa 100644 --- a/classes/ExternalGroupDto.html +++ b/classes/ExternalGroupDto.html @@ -347,7 +347,7 @@
ExternalGroupUserDto[]
+ Type : ExternalGroupUserDto[]
mapDomainObjectToEntityProperties(group: Group, em: EntityManager)
+ mapDomainObjectToEntityProperties(group: Group, em: EntityManager)
Group
+ Group
ExternalGroupDto[]
+ Type : ExternalGroupDto[]
+
+ apps/server/src/modules/pseudonym/mapper/pseudonym.mapper.ts
+
+ Methods+ |
+
+
|
+
+ + + Static + mapToResponse + + + | +||||||
+
+ mapToResponse(pseudonym: Pseudonym)
+ |
+ ||||||
+ + | +||||||
+
+
+ Parameters :
+
+
+
+
+
+ Returns :
+ PseudonymResponse
+
+
+
+
+ |
+
import { Pseudonym } from '@shared/domain';
+import { PseudonymResponse } from '../controller/dto';
+
+export class PseudonymMapper {
+ static mapToResponse(pseudonym: Pseudonym): PseudonymResponse {
+ const response: PseudonymResponse = new PseudonymResponse({
+ id: pseudonym.id,
+ toolId: pseudonym.toolId,
+ userId: pseudonym.userId,
+ });
+
+ return response;
+ }
+}
+
+ +
+ apps/server/src/modules/pseudonym/controller/dto/pseudonym-params.ts
+
+ Properties+ |
+
+
|
+
+ + + + + pseudonym + + + | +
+ Type : string
+
+ |
+
+ Decorators :
+ +
+ @IsString()
+ |
+
+ + | +
import { ApiProperty } from '@nestjs/swagger';
+import { IsString } from 'class-validator';
+
+export class PseudonymParams {
+ @IsString()
+ @ApiProperty({ nullable: false, required: true })
+ pseudonym!: string;
+}
+
+ +
+ apps/server/src/modules/pseudonym/controller/dto/pseudonym.response.ts
+
+ Properties+ |
+
+ + | +
+constructor(response: PseudonymResponse)
+ |
+ ||||||
+ + | +||||||
+
+ Parameters :
+
+
|
+
+ + + + id + + + | +
+ Type : string
+
+ |
+
+ Decorators :
+ +
+ @ApiProperty()
+ |
+
+ + | +
+ + + + toolId + + + | +
+ Type : string
+
+ |
+
+ Decorators :
+ +
+ @ApiProperty()
+ |
+
+ + | +
+ + + + userId + + + | +
+ Type : string
+
+ |
+
+ Decorators :
+ +
+ @ApiProperty()
+ |
+
+ + | +
import { ApiProperty } from '@nestjs/swagger';
+
+export class PseudonymResponse {
+ @ApiProperty()
+ id: string;
+
+ @ApiProperty()
+ toolId: string;
+
+ @ApiProperty()
+ userId: string;
+
+ constructor(response: PseudonymResponse) {
+ this.id = response.id;
+ this.toolId = response.toolId;
+ this.userId = response.userId;
+ }
+}
+
+ +
+ apps/server/src/modules/pseudonym/entity/pseudonym.scope.ts
+
+
+ Scope
+
+ Properties+ |
+
+
|
+
+ Methods+ |
+
+
|
+
+ + + Private + _allowEmptyQuery + + + | +
+ Type : boolean
+
+ |
+
+ Inherited from
+ Scope
+ |
+
+ Defined in
+ Scope:13
+ |
+
+ + + Private + _operator + + + | +
+ Type : ScopeOperator
+
+ |
+
+ Inherited from
+ Scope
+ |
+
+ Defined in
+ Scope:11
+ |
+
+ + + Private + _queries + + + | +
+ Type : FilterQuery<T | EmptyResultQueryType>[]
+
+ |
+
+ Default value : []
+ |
+
+ Inherited from
+ Scope
+ |
+
+ Defined in
+ Scope:9
+ |
+
+ + + byToolId + + + | +||||||
+byToolId(toolId: string | undefined)
+ |
+ ||||||
+ + | +||||||
+
+
+ Parameters :
+
+
+
+
+ |
+
+ + + byUserId + + + | +||||||
+byUserId(userId: string | undefined)
+ |
+ ||||||
+ + | +||||||
+
+
+ Parameters :
+
+
+
+
+ |
+
+ + + addQuery + + + | +||||||
+addQuery(query: FilterQuery<T> | EmptyResultQueryType)
+ |
+ ||||||
+ Inherited from
+ Scope
+ |
+ ||||||
+ Defined in
+ Scope:31
+ |
+ ||||||
+
+
+ Parameters :
+
+
+
+
+
+ Returns :
+ void
+
+
+
+
+ |
+
+ + + allowEmptyQuery + + + | +||||||
+allowEmptyQuery(isEmptyQueryAllowed: boolean)
+ |
+ ||||||
+ Inherited from
+ Scope
+ |
+ ||||||
+ Defined in
+ Scope:35
+ |
+ ||||||
+
+
+ Parameters :
+
+
+
+
+
+ Returns :
+ Scope<T>
+
+
+
+
+ |
+
import { Scope } from '@shared/repo';
+import { ObjectId } from 'bson';
+import { ExternalToolPseudonymEntity } from './external-tool-pseudonym.entity';
+
+export class PseudonymScope extends Scope<ExternalToolPseudonymEntity> {
+ byPseudonym(pseudonym: string | undefined): this {
+ if (pseudonym) {
+ this.addQuery({ pseudonym });
+ }
+ return this;
+ }
+
+ byUserId(userId: string | undefined): this {
+ if (userId) {
+ this.addQuery({ userId: new ObjectId(userId) });
+ }
+ return this;
+ }
+
+ byToolId(toolId: string | undefined): this {
+ if (toolId) {
+ this.addQuery({ toolId: new ObjectId(toolId) });
+ }
+ return this;
+ }
+}
+
+ constructor(submissionItemsResponse: SubmissionItemResponse[], users: UserDataResponse[])
+constructor(submissionItemsResponse: SubmissionItemResponse[], users: UserDataResponse[])
UserDataResponse[]
+ UserDataResponse[]
UserDataResponse[]
+ Type : UserDataResponse[]
+
+ apps/server/src/modules/pseudonym/controller/pseudonym.controller.ts
+
+
+ pseudonyms
+
+ Methods+ |
+
+
|
+
+ + + + + + + + Async + getPseudonym + + + | +|||||||||
+
+ getPseudonym(params: PseudonymParams, currentUser: ICurrentUser)
+ |
+ |||||||||
+ Decorators :
+ + @Get(':pseudonym')
+ |
+ |||||||||
+ + | +|||||||||
+
+
+ Parameters :
+
+
+
+
+
+ Returns :
+ Promise<PseudonymResponse>
+
+
+
+
+ |
+
import { Controller, Get, Param } from '@nestjs/common';
+import {
+ ApiForbiddenResponse,
+ ApiFoundResponse,
+ ApiOperation,
+ ApiTags,
+ ApiUnauthorizedResponse,
+} from '@nestjs/swagger';
+import { Pseudonym } from '@shared/domain';
+import { Authenticate, CurrentUser } from '@src/modules/authentication/decorator/auth.decorator';
+import { ICurrentUser } from '@src/modules/authentication';
+import { PseudonymMapper } from '../mapper/pseudonym.mapper';
+import { PseudonymUc } from '../uc';
+import { PseudonymResponse } from './dto';
+import { PseudonymParams } from './dto/pseudonym-params';
+
+@ApiTags('Pseudonym')
+@Authenticate('jwt')
+@Controller('pseudonyms')
+export class PseudonymController {
+ constructor(private readonly pseudonymUc: PseudonymUc) {}
+
+ @Get(':pseudonym')
+ @ApiFoundResponse({ description: 'Pseudonym has been found.', type: PseudonymResponse })
+ @ApiUnauthorizedResponse()
+ @ApiForbiddenResponse()
+ @ApiOperation({ summary: 'Returns the related user and tool information to a pseudonym' })
+ async getPseudonym(
+ @Param() params: PseudonymParams,
+ @CurrentUser() currentUser: ICurrentUser
+ ): Promise<PseudonymResponse> {
+ const pseudonym: Pseudonym = await this.pseudonymUc.findPseudonymByPseudonym(currentUser.userId, params.pseudonym);
+
+ const pseudonymResponse: PseudonymResponse = PseudonymMapper.mapToResponse(pseudonym);
+
+ return pseudonymResponse;
+ }
+}
+
+ GroupUserEntity[]
+ Type : GroupUserEntity[]
ITargetGroupProperties[] |
+ Type : ITargetGroupProperties[] |