Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
intrn(server): add method to determine if the request is new or old
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Oct 14, 2022
1 parent 02c565f commit 7aebdc2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/singletons/asynchronous_operation_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import TransactionManager from "%/helpers/transaction_manager"
export default class extends TransactionManager implements TransactionManagerInterface {
private manager: BaseManager<any, any, any, any, any, any>|null = null
private id = 0
private hasFound = false

/**
* Expects body of request to be raw.
Expand All @@ -35,6 +36,8 @@ export default class extends TransactionManager implements TransactionManagerInt
let possibleResource = possibleDocument.data

if (possibleResource === null) {
this.hasFound = false

const createdDocument = await this.manager.create({
"extra": {},
"finishedStepCount": 0,
Expand All @@ -51,4 +54,6 @@ export default class extends TransactionManager implements TransactionManagerInt

this.id = Number(castResource.id)
}

get isNew(): boolean { return !this.hasFound }
}

0 comments on commit 7aebdc2

Please sign in to comment.