This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
generated from KennethTrecy/web_template
-
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.
intrn(server): initialize with request
- Loading branch information
1 parent
922a6dc
commit c0cb5a7
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
server/middlewares/miscellaneous/asynchronous_operation_initializer.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,25 @@ | ||
import type { AsynchronousRequest, BaseManagerClass } from "!/types/dependent" | ||
|
||
import RequestFilter from "!/bases/request_filter" | ||
import AsynchronousOperationManager from "!/singletons/asynchronous_operation_manager" | ||
|
||
export default class AsynchronousOperationInitializer extends RequestFilter { | ||
private managerClass: BaseManagerClass | ||
private totalStepCount: number | ||
|
||
constructor(managerClass: BaseManagerClass, totalStepCount: number) { | ||
super() | ||
this.managerClass = managerClass | ||
this.totalStepCount = totalStepCount | ||
} | ||
|
||
async filterRequest(request: AsynchronousRequest): Promise<void> { | ||
request.asynchronousOperation = new AsynchronousOperationManager() | ||
|
||
await request.asynchronousOperation.initializeWithRequest( | ||
request, | ||
this.managerClass, | ||
this.totalStepCount | ||
) | ||
} | ||
} |