-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
将sdk,api-file,sheet等模块的事件触发机制从手动发送修改为订阅orm触发
- Loading branch information
1 parent
467124b
commit d88f16b
Showing
22 changed files
with
303 additions
and
49 deletions.
There are no files selected for viewing
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
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
3 changes: 2 additions & 1 deletion
3
app/backend/src/modules/api-file/events/api-file-created.event.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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { EntityDTO, Loaded } from '@mikro-orm/core' | ||
import { ApiFile } from '../entities/api-file.entity' | ||
|
||
export class ApiFileCreatedEvent { | ||
constructor( | ||
public apiFile: ApiFile | ||
public apiFile: EntityDTO<Loaded<ApiFile>> | ||
) { | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
app/backend/src/modules/api-file/events/api-file-deleted.event.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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { EntityDTO, Loaded } from '@mikro-orm/core' | ||
import { ApiFile } from '../entities/api-file.entity' | ||
|
||
|
||
export class ApiFileDeletedEvent { | ||
constructor( | ||
public apiFile: ApiFile | ||
public apiFile: EntityDTO<Loaded<ApiFile>> | ||
) { | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
.../src/modules/plugin/dto/plugin-event-message/sdk-deleted-plugin-event-message-data.dto.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,16 @@ | ||
import { Type } from 'class-transformer' | ||
import { ValidateNested } from 'class-validator' | ||
import { SdkDTO } from '~/modules/sdk/dto/sdk.dto' | ||
import { ParsedVersionDTO } from '~/modules/sheet-version/dto/parsed-version.dto' | ||
import { BasePluginEventMessageData } from './base-plugin-event-message-data.dto' | ||
|
||
|
||
export class SdkDeletedPluginEventMessageData extends BasePluginEventMessageData { | ||
@ValidateNested() | ||
@Type(() => SdkDTO) | ||
sdk!: SdkDTO | ||
|
||
@ValidateNested() | ||
@Type(() => ParsedVersionDTO) | ||
version!: ParsedVersionDTO | ||
} |
16 changes: 16 additions & 0 deletions
16
.../src/modules/plugin/dto/plugin-event-message/sdk-updated-plugin-event-message-data.dto.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,16 @@ | ||
import { Type } from 'class-transformer' | ||
import { ValidateNested } from 'class-validator' | ||
import { SdkDTO } from '~/modules/sdk/dto/sdk.dto' | ||
import { ParsedVersionDTO } from '~/modules/sheet-version/dto/parsed-version.dto' | ||
import { BasePluginEventMessageData } from './base-plugin-event-message-data.dto' | ||
|
||
|
||
export class SdkUpdatedPluginEventMessageData extends BasePluginEventMessageData { | ||
@ValidateNested() | ||
@Type(() => SdkDTO) | ||
sdk!: SdkDTO | ||
|
||
@ValidateNested() | ||
@Type(() => ParsedVersionDTO) | ||
version!: ParsedVersionDTO | ||
} |
16 changes: 16 additions & 0 deletions
16
...rc/modules/plugin/dto/plugin-event-message/sheet-created-plugin-event-message-data.dto.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,16 @@ | ||
import { ApplicationDTO } from '~/modules/application/dto/application.dto' | ||
import { SheetDTO } from '~/modules/sheet/dto/sheet.dto' | ||
import { ValidateNested } from 'class-validator' | ||
import { Type } from 'class-transformer' | ||
import { BasePluginEventMessageData } from './base-plugin-event-message-data.dto' | ||
|
||
|
||
export class SheetCreatedPluginEventMessageData extends BasePluginEventMessageData { | ||
@ValidateNested() | ||
@Type(() => ApplicationDTO) | ||
application!: ApplicationDTO | ||
|
||
@ValidateNested() | ||
@Type(() => SheetDTO) | ||
sheet!: SheetDTO | ||
} |
16 changes: 16 additions & 0 deletions
16
...rc/modules/plugin/dto/plugin-event-message/sheet-deleted-plugin-event-message-data.dto.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,16 @@ | ||
import { ApplicationDTO } from '~/modules/application/dto/application.dto' | ||
import { SheetDTO } from '~/modules/sheet/dto/sheet.dto' | ||
import { ValidateNested } from 'class-validator' | ||
import { Type } from 'class-transformer' | ||
import { BasePluginEventMessageData } from './base-plugin-event-message-data.dto' | ||
|
||
|
||
export class SheetDeletedPluginEventMessageData extends BasePluginEventMessageData { | ||
@ValidateNested() | ||
@Type(() => ApplicationDTO) | ||
application!: ApplicationDTO | ||
|
||
@ValidateNested() | ||
@Type(() => SheetDTO) | ||
sheet!: SheetDTO | ||
} |
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
15 changes: 15 additions & 0 deletions
15
app/backend/src/modules/plugin/types/plugin-event-message-data-map.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 |
---|---|---|
@@ -1,11 +1,26 @@ | ||
import { PluginEventName } from '../constants/plugin-event-name' | ||
import { BasePluginEventMessageData } from '../dto/plugin-event-message/base-plugin-event-message-data.dto' | ||
import { SdkCreatedPluginEventMessageData } from '../dto/plugin-event-message/sdk-created-plugin-event-message-data.dto' | ||
import { SdkDeletedPluginEventMessageData } from '../dto/plugin-event-message/sdk-deleted-plugin-event-message-data.dto' | ||
import { SdkUpdatedPluginEventMessageData } from '../dto/plugin-event-message/sdk-updated-plugin-event-message-data.dto' | ||
import { SheetCreatedPluginEventMessageData } from '../dto/plugin-event-message/sheet-created-plugin-event-message-data.dto' | ||
import { SheetDeletedPluginEventMessageData } from '../dto/plugin-event-message/sheet-deleted-plugin-event-message-data.dto' | ||
import { SheetVersionBumpPluginEventMessageData } from '../dto/plugin-event-message/sheet-version-bump-plugin-event-message-data.dto' | ||
|
||
|
||
export interface PluginEventMessageDataMap extends Record<PluginEventName, BasePluginEventMessageData> { | ||
[PluginEventName.SHEET_CREATED]: SheetCreatedPluginEventMessageData | ||
[PluginEventName.SHEET_DELETED]: SheetDeletedPluginEventMessageData | ||
|
||
[PluginEventName.SHEET_VERSION_BUMP]: SheetVersionBumpPluginEventMessageData | ||
|
||
[PluginEventName.SDK_CREATED]: SdkCreatedPluginEventMessageData | ||
[PluginEventName.SDK_UPDATED]: SdkUpdatedPluginEventMessageData | ||
[PluginEventName.SDK_DELETED]: SdkDeletedPluginEventMessageData | ||
|
||
[PluginEventName.API_FILE_CREATED]: BasePluginEventMessageData | ||
[PluginEventName.API_FILE_UPDATED]: BasePluginEventMessageData | ||
[PluginEventName.API_FILE_DELETED]: BasePluginEventMessageData | ||
|
||
[PluginEventName.TERMINATED]: BasePluginEventMessageData | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { EntityDTO, Loaded } from '@mikro-orm/core' | ||
import { Sdk } from '../entities/sdk.entity' | ||
|
||
|
||
export class SdkDeletedEvent { | ||
constructor( | ||
public sdk: EntityDTO<Loaded<Sdk>>, | ||
) { | ||
} | ||
} | ||
|
||
|
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
Oops, something went wrong.