Skip to content

Commit

Permalink
Deadline Override Type Support (#68)
Browse files Browse the repository at this point in the history
* feat(UserMatch): deadline overrides

* 0.25.38

* 0.25.39

* feat(match): use blid instead of customerItem IDs

* 0.25.40

* feat(match): update dto for match to use blid

* 0.25.41
  • Loading branch information
AdrianAndersen authored Jun 11, 2024
1 parent 985ad83 commit daf5ab3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@boklisten/bl-model",
"version": "0.25.37",
"version": "0.25.41",
"description": "generic classes for use in all boklisten apps",
"license": "MIT",
"main": "index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/match/match-dtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export type MatchWithDetails = (
| (UserMatch & {
senderDetails: MatchRelevantUserDetails;
receiverDetails: MatchRelevantUserDetails;
customerItemToItemMap: {
[customerItemId: string]: string;
blIdToItemMap: {
[blId: string]: string;
};
})
) & {
Expand Down
13 changes: 9 additions & 4 deletions src/match/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,27 @@ export class MatchBase extends BlDocument {

export class UserMatch extends MatchBase {
_variant: MatchVariant.UserMatch = MatchVariant.UserMatch;
// customerItems owned by sender which have been given to anyone. May differ from receivedCustomerItems
// unique items owned by sender which have been given to anyone. May differ from receivedBlIds
// when a book is borrowed and handed over to someone other than the technical owner's match
deliveredCustomerItems: string[] = [];
// customerItems which have been received by the receiver from anyone
receivedCustomerItems: string[] = [];
deliveredBlIds: string[] = [];
// unique items which have been received by the receiver from anyone
receivedBlIds: string[] = [];
// if true, disallow handing the items out or in at a stand, only allow match exchange
itemsLockedToMatch: boolean = true;
// when receiver items have overrides, the generated customer items will
// get the deadline specified in the override instead of using the branch period deadline
deadlineOverrides: { item: string; deadline: string }[] = [];

constructor(
public sender: string,
public receiver: string,
// items which are expected to be handed over from sender to receiver
public expectedItems: string[],
meetingInfo: MatchBase["meetingInfo"],
deadlineOverrides: { item: string; deadline: string }[],
) {
super(meetingInfo);
this.deadlineOverrides = deadlineOverrides;
}
}

Expand Down

0 comments on commit daf5ab3

Please sign in to comment.