-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4731 from alkem-io/develop
Release: Entitlements
- Loading branch information
Showing
136 changed files
with
3,516 additions
and
842 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { registerEnumType } from '@nestjs/graphql'; | ||
|
||
export enum LicenseEntitlementDataType { | ||
LIMIT = 'limit', | ||
FLAG = 'flag', | ||
} | ||
|
||
registerEnumType(LicenseEntitlementDataType, { | ||
name: 'LicenseEntitlementDataType', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { registerEnumType } from '@nestjs/graphql'; | ||
|
||
export enum LicenseEntitlementType { | ||
ACCOUNT_SPACE_FREE = 'account-space-free', | ||
ACCOUNT_SPACE_PLUS = 'account-space-plus', | ||
ACCOUNT_SPACE_PREMIUM = 'account-space-premium', | ||
ACCOUNT_VIRTUAL_CONTRIBUTOR = 'account-virtual-contributor', | ||
ACCOUNT_INNOVATION_PACK = 'account-innovation-pack', | ||
ACCOUNT_INNOVATION_HUB = 'account-innovation-hub', | ||
SPACE_FREE = 'space-free', | ||
SPACE_PLUS = 'space-plus', | ||
SPACE_PREMIUM = 'space-premium', | ||
SPACE_FLAG_SAVE_AS_TEMPLATE = 'space-flag-save-as-template', | ||
SPACE_FLAG_VIRTUAL_CONTRIBUTOR_ACCESS = 'space-flag-virtual-contributor-access', | ||
SPACE_FLAG_WHITEBOARD_MULTI_USER = 'space-flag-whiteboard-multi-user', | ||
} | ||
|
||
registerEnumType(LicenseEntitlementType, { | ||
name: 'LicenseEntitlementType', | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { registerEnumType } from '@nestjs/graphql'; | ||
|
||
export enum LicenseType { | ||
ACCOUNT = 'account', | ||
SPACE = 'space', | ||
WHITEBOARD = 'whiteboard', | ||
ROLESET = 'roleset', | ||
COLLABORATION = 'collaboration', | ||
} | ||
|
||
registerEnumType(LicenseType, { | ||
name: 'LicenseType', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/common/exceptions/license.entitlement.not.available.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { LogContext, AlkemioErrorStatus } from '@common/enums'; | ||
import { BaseException } from './base.exception'; | ||
|
||
export class LicenseEntitlementNotAvailableException extends BaseException { | ||
constructor(error: string, context: LogContext, code?: AlkemioErrorStatus) { | ||
super( | ||
error, | ||
context, | ||
code ?? AlkemioErrorStatus.LICENSE_ENTITLEMENT_NOT_AVAILABLE | ||
); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/common/exceptions/license.entitlement.not.supported.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { LogContext, AlkemioErrorStatus } from '@common/enums'; | ||
import { BaseException } from './base.exception'; | ||
|
||
export class LicenseEntitlementNotSupportedException extends BaseException { | ||
constructor(error: string, context: LogContext, code?: AlkemioErrorStatus) { | ||
super( | ||
error, | ||
context, | ||
code ?? AlkemioErrorStatus.LICENSE_ENTITLEMENT_NOT_SUPPORTED | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/core/dataloader/creators/loader.creators/license.loader.creator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { EntityManager } from 'typeorm'; | ||
import { Injectable } from '@nestjs/common'; | ||
import { InjectEntityManager } from '@nestjs/typeorm'; | ||
import { DataLoaderInitError } from '@common/exceptions/data-loader'; | ||
import { createTypedRelationDataLoader } from '../../utils'; | ||
import { DataLoaderCreator, DataLoaderCreatorOptions } from '../base'; | ||
import { ILicense } from '@domain/common/license/license.interface'; | ||
import { License } from '@domain/common/license/license.entity'; | ||
|
||
@Injectable() | ||
export class LicenseLoaderCreator implements DataLoaderCreator<ILicense> { | ||
constructor(@InjectEntityManager() private manager: EntityManager) {} | ||
|
||
create( | ||
options?: DataLoaderCreatorOptions< | ||
ILicense, | ||
{ id: string; license?: License } | ||
> | ||
) { | ||
if (!options?.parentClassRef) { | ||
throw new DataLoaderInitError( | ||
`${this.constructor.name} requires the 'parentClassRef' to be provided.` | ||
); | ||
} | ||
|
||
return createTypedRelationDataLoader( | ||
this.manager, | ||
options.parentClassRef, | ||
{ | ||
license: true, | ||
}, | ||
this.constructor.name, | ||
options | ||
); | ||
} | ||
} |
Oops, something went wrong.