Skip to content

Commit 1d925bb

Browse files
Add isDebug (#453)
* Add isDebug * Bump version up to 1.1.5 * Update workspace.ts --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 8547958 commit 1d925bb

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hawk.api",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"main": "index.ts",
55
"license": "UNLICENSED",
66
"scripts": {

src/models/workspace.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export default class WorkspaceModel extends AbstractModel<WorkspaceDBScheme> imp
7171
*/
7272
public subscriptionId!: string | undefined;
7373

74+
/**
75+
* True if workspace is used for debugging
76+
*/
77+
public isDebug?: boolean;
78+
7479
/**
7580
* Model's collection
7681
*/
@@ -411,6 +416,10 @@ export default class WorkspaceModel extends AbstractModel<WorkspaceDBScheme> imp
411416
public getTariffPlanDueDate(): Date {
412417
const lastChargeDate = new Date(this.lastChargeDate);
413418

419+
if (this.isDebug) {
420+
return new Date(lastChargeDate.setDate(lastChargeDate.getDate() + 1));
421+
}
422+
414423
return new Date(lastChargeDate.setMonth(lastChargeDate.getMonth() + 1));
415424
}
416425

src/resolvers/billingNew.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,11 @@ export default {
163163
const dueDate = workspace.getTariffPlanDueDate();
164164

165165
if (args.input.isRecurrent) {
166+
const interval = workspace.isDebug ? 'Day' : 'Month';
167+
166168
jsonData.cloudPayments = {
167169
recurrent: {
168-
interval: 'Month',
170+
interval,
169171
period: 1,
170172
},
171173
};

src/typeDefs/workspace.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ export default gql`
116116
"""
117117
subscriptionId: String
118118
119+
""" True if workspace is used for debugging """
120+
isDebug: Boolean
121+
119122
"""
120123
Workspace projects array
121124
"""

0 commit comments

Comments
 (0)