-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* N21-1319 externaltool metadata * N21-1319 schoolexternaltool metadata * N21-1319 add ExternalToolMetadataService * N21-1319 add SchoolExternalToolMetadataService * N21-1319 loggable
- Loading branch information
Showing
33 changed files
with
1,010 additions
and
29 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
apps/server/src/modules/tool/common/mapper/tool-context.mapper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ToolContextType } from '../enum'; | ||
import { ContextExternalToolType } from '../../context-external-tool/entity'; | ||
|
||
export class ToolContextMapper { | ||
static contextMapping: Record<ToolContextType, ContextExternalToolType> = { | ||
[ToolContextType.COURSE]: ContextExternalToolType.COURSE, | ||
[ToolContextType.BOARD_ELEMENT]: ContextExternalToolType.BOARD_ELEMENT, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...src/modules/tool/external-tool/controller/dto/response/external-tool-metadata.response.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { ContextExternalToolType } from '../../../../context-external-tool/entity'; | ||
|
||
export class ExternalToolMetadataResponse { | ||
@ApiProperty() | ||
schoolExternalToolCount: number; | ||
|
||
@ApiProperty({ | ||
type: 'object', | ||
properties: Object.fromEntries( | ||
Object.values(ContextExternalToolType).map((key: ContextExternalToolType) => [key, { type: 'number' }]) | ||
), | ||
}) | ||
contextExternalToolCountPerContext: Record<ContextExternalToolType, number>; | ||
|
||
constructor(externalToolMetadataResponse: ExternalToolMetadataResponse) { | ||
this.schoolExternalToolCount = externalToolMetadataResponse.schoolExternalToolCount; | ||
this.contextExternalToolCountPerContext = externalToolMetadataResponse.contextExternalToolCountPerContext; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
apps/server/src/modules/tool/external-tool/domain/external-tool-metadata.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export class ExternalToolMetadata { | ||
schoolExternalToolCount: number; | ||
|
||
contextExternalToolCountPerContext: Record<string, number>; | ||
|
||
constructor(externalToolMetadata: ExternalToolMetadata) { | ||
this.schoolExternalToolCount = externalToolMetadata.schoolExternalToolCount; | ||
this.contextExternalToolCountPerContext = externalToolMetadata.contextExternalToolCountPerContext; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './external-tool.do'; | ||
export * from './config'; | ||
export * from './external-tool-metadata'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
apps/server/src/modules/tool/external-tool/mapper/external-tool-metadata.mapper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ExternalToolMetadataResponse } from '../controller/dto'; | ||
import { ExternalToolMetadata } from '../domain'; | ||
|
||
export class ExternalToolMetadataMapper { | ||
static mapToExternalToolMetadataResponse(externalToolMetadata: ExternalToolMetadata): ExternalToolMetadataResponse { | ||
const externalToolMetadataResponse: ExternalToolMetadataResponse = new ExternalToolMetadataResponse({ | ||
schoolExternalToolCount: externalToolMetadata.schoolExternalToolCount, | ||
contextExternalToolCountPerContext: externalToolMetadata.contextExternalToolCountPerContext, | ||
}); | ||
|
||
return externalToolMetadataResponse; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './external-tool-request.mapper'; | ||
export * from './external-tool-response.mapper'; | ||
export * from './external-tool-metadata.mapper'; |
Oops, something went wrong.