correct register user default billable flag
MODIFY
src/server/rest/v1/service/AuthService.ts
src/server/rest/v1/service/AuthService.ts
import { ExtractJwt, Strategy } from 'passport-jwt';
import { Handler, NextFunction, Request, RequestHandler, Response } from 'express';
import { HttpLoginRequest, HttpResetPasswordRequest } from '../../../../types/requests/HttpUserRequest';
-import User, { UserRole, UserStatus } from '../../../../types/User';
+import User, { USER_BILLABLE_DEFAULT, UserRole, UserStatus } from '../../../../types/User';
import AppError from '../../../../exception/AppError';
import AuthValidator from '../validator/AuthValidator';
@@ -244,6 +244,8 @@ export default class AuthService {
await UserStorage.addSitesToUser(tenant, newUser.id, siteIDs);
}
}
+ // Set new user default billable value
+ await UserStorage.saveUserAdminData(tenant, newUser.id, { billable: USER_BILLABLE_DEFAULT });
// Log
await Logging.logSecurityInfo({
tenantID: tenant.id,

MODIFY
src/storage/mongodb/UserStorage.ts
src/storage/mongodb/UserStorage.ts
import FeatureToggles, { Feature } from '../../utils/FeatureToggles';
import Site, { SiteUser } from '../../types/Site';
import Tenant, { TenantComponents } from '../../types/Tenant';
-import User, { ImportedUser, USER_BILLABLE_DEFAULT, UserRole, UserStatus } from '../../types/User';
+import User, { ImportedUser, UserRole, UserStatus } from '../../types/User';
import { UserInError, UserInErrorType } from '../../types/InError';
import global, { FilterParams, Image, ImportStatus } from '../../types/GlobalType';
@@ -1154,8 +1154,7 @@ export default class UserStorage {
sendAdminAccountVerificationNotification: false,
},
role: UserRole.BASIC,
- status: UserStatus.PENDING,
- billable: USER_BILLABLE_DEFAULT
+ status: UserStatus.PENDING
};
}

correct register user default billable flag