@stamhoofd/backend 2.77.4 → 2.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env.ci.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "environment": "test",
3
+ "domains": {
4
+ "dashboard": "dashboard.stamhoofd.dev",
5
+ "registration": {
6
+ "": "stamhoofd.dev",
7
+ "BE": "dev.stamhoofd.be",
8
+ "NL": "dev.stamhoofd.nl"
9
+ },
10
+ "webshop": "shop.stamhoofd.dev",
11
+ "api": "api.stamhoofd.dev"
12
+ },
13
+
14
+ "PORT": 9091,
15
+ "DB_HOST": "127.0.0.1",
16
+ "DB_USER": "root",
17
+ "DB_PASS": "root",
18
+ "DB_DATABASE": "stamhoofd",
19
+
20
+ "SMTP_HOST": "email-smtp.eu-west-1.amazonaws.com",
21
+ "SMTP_USERNAME": "test",
22
+ "SMTP_PASSWORD": "test",
23
+ "SMTP_PORT": 587,
24
+
25
+ "AWS_ACCESS_KEY_ID": "",
26
+ "AWS_SECRET_ACCESS_KEY": "",
27
+ "AWS_REGION": "",
28
+
29
+ "SPACES_ENDPOINT": "ams3.digitaloceanspaces.com",
30
+ "SPACES_BUCKET": "stamhoofd",
31
+ "SPACES_KEY": "",
32
+ "SPACES_SECRET": "",
33
+
34
+ "INTERNAL_SECRET_KEY": "test",
35
+
36
+ "STRIPE_SECRET_KEY": "test",
37
+ "STRIPE_ENDPOINT_SECRET": "test",
38
+ "translationNamespace": "digit",
39
+ "platformName": "ravot",
40
+ "userMode": "organization",
41
+ "WHITELISTED_EMAIL_DESTINATIONS": []
42
+ }
package/index.ts CHANGED
@@ -30,7 +30,7 @@ process.on('unhandledRejection', (error: Error) => {
30
30
  // Set version of saved structures
31
31
  Column.setJSONVersion(Version);
32
32
 
33
- // Set timezone!
33
+ // Set timezone
34
34
  process.env.TZ = 'UTC';
35
35
 
36
36
  // Quick check
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamhoofd/backend",
3
- "version": "2.77.4",
3
+ "version": "2.78.0",
4
4
  "main": "./dist/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -37,14 +37,14 @@
37
37
  "@simonbackx/simple-encoding": "2.20.0",
38
38
  "@simonbackx/simple-endpoints": "1.19.1",
39
39
  "@simonbackx/simple-logging": "^1.0.1",
40
- "@stamhoofd/backend-i18n": "2.77.4",
41
- "@stamhoofd/backend-middleware": "2.77.4",
42
- "@stamhoofd/email": "2.77.4",
43
- "@stamhoofd/models": "2.77.4",
44
- "@stamhoofd/queues": "2.77.4",
45
- "@stamhoofd/sql": "2.77.4",
46
- "@stamhoofd/structures": "2.77.4",
47
- "@stamhoofd/utility": "2.77.4",
40
+ "@stamhoofd/backend-i18n": "2.78.0",
41
+ "@stamhoofd/backend-middleware": "2.78.0",
42
+ "@stamhoofd/email": "2.78.0",
43
+ "@stamhoofd/models": "2.78.0",
44
+ "@stamhoofd/queues": "2.78.0",
45
+ "@stamhoofd/sql": "2.78.0",
46
+ "@stamhoofd/structures": "2.78.0",
47
+ "@stamhoofd/utility": "2.78.0",
48
48
  "archiver": "^7.0.1",
49
49
  "aws-sdk": "^2.885.0",
50
50
  "axios": "1.6.8",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "e41b2942f787a4e8eb1f77ebb7c9b68d33fb4e69"
67
+ "gitHead": "7dedb2d33af820a18f9a246d2ab44016ea4fcff5"
68
68
  }
@@ -1,6 +1,6 @@
1
1
  import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
2
- import { CachedBalance, Member, Organization } from '@stamhoofd/models';
3
- import { PayableBalanceCollection, PayableBalance } from '@stamhoofd/structures';
2
+ import { CachedBalance, Organization } from '@stamhoofd/models';
3
+ import { PayableBalance, PayableBalanceCollection } from '@stamhoofd/structures';
4
4
 
5
5
  import { Formatter } from '@stamhoofd/utility';
6
6
  import { AuthenticatedStructures } from '../../../helpers/AuthenticatedStructures';
@@ -31,9 +31,7 @@ export class GetUserPayableBalanceEndpoint extends Endpoint<Params, Query, Body,
31
31
  const organization = await Context.setUserOrganizationScope();
32
32
  const { user } = await Context.authenticate();
33
33
 
34
- const memberIds = await Member.getMemberIdsWithRegistrationForUser(user);
35
-
36
- return new Response(await GetUserPayableBalanceEndpoint.getBillingStatusForObjects([user.id, ...memberIds], organization));
34
+ return new Response(await GetUserPayableBalanceEndpoint.getBillingStatusForObjects([user.id], organization));
37
35
  }
38
36
 
39
37
  static async getBillingStatusForObjects(objectIds: string[], organization?: Organization | null) {
@@ -33,7 +33,6 @@ export const MembershipCharger = {
33
33
  while (true) {
34
34
  const memberships = await MemberPlatformMembership.select()
35
35
  .where('id', SQLWhereSign.Greater, lastId)
36
- .where('balanceItemId', null)
37
36
  .where('deletedAt', null)
38
37
  .where('locked', false)
39
38
  .where(SQL.where('trialUntil', null).or('trialUntil', SQLWhereSign.LessEqual, new Date()))
@@ -57,6 +56,11 @@ export const MembershipCharger = {
57
56
  for (const membership of memberships) {
58
57
  // charge
59
58
  if (membership.balanceItemId) {
59
+ if (!membership.locked) {
60
+ // Lock this membership
61
+ membership.locked = true;
62
+ await membership.save();
63
+ }
60
64
  continue;
61
65
  }
62
66