-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EC-002: Working on data layer schema updates #6
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
efbb642
ar(feat) update action types
angeloreale ff47cc4
ar(feat) add authorization types
angeloreale 14c1da5
ar(feat) add services types
angeloreale 35b475f
ar(feat) update users types
angeloreale b79ec50
ar(feat) update orgs typesdefault schema
angeloreale 23db83e
ar(feat) finish types split
angeloreale 7a52bea
ar(feat) removing hardcoded strings and pointing to SST
angeloreale 4123a92
ar(feat) decorating schemas for init data layer
angeloreale 573fea0
ar(qa) minute and verbs
angeloreale 2f032ca
ar(qa) fuzzy abilities
angeloreale 3d19495
ar(qa) generic db names
angeloreale ccec9d1
ar(qa) lower es target
angeloreale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
# temporary | ||
system/ | ||
components/ | ||
nsx/ | ||
nsx/ | ||
mock/ |
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,86 @@ | ||
// org.ts | ||
import type { | ||
NexusActionTypes, | ||
IActionTypes, | ||
IServiceUserAmbiRelation, | ||
IFeatureSet, | ||
OrgDecoration, | ||
INCharacter, | ||
} from '@types'; | ||
import { EFeatureStatus, EServiceTypes, EServiceStatus, EServiceNames } from '@constants'; | ||
import { DEFAULT_ORG } from '@model'; | ||
import { defaultAbilities } from '@schema/user'; | ||
|
||
interface INexusSet extends Set<IActionTypes> { | ||
gimme?: (value: string) => string[] | []; | ||
} | ||
|
||
const publicNexusActions: Set<NexusActionTypes> = new Set(['init', 'login', 'logout', 'hydrate'] as NexusActionTypes[]); | ||
const iterablePublicActions: NexusActionTypes[] = Array.from(publicNexusActions); | ||
|
||
const commonActions: INexusSet = new Set<IActionTypes>(['like']); | ||
commonActions.gimme = (value: string) => { | ||
if (commonActions.has(value)) return [value]; | ||
return []; | ||
}; | ||
|
||
export const nominalRMActions = [...iterablePublicActions, commonActions.gimme('like')]; | ||
|
||
export const defaultRMActions = nominalRMActions.reduce((acc, actionType: IActionTypes) => { | ||
return { | ||
...acc, | ||
[actionType]: true, | ||
}; | ||
}, {}); | ||
|
||
export const defaultRMFeatures: IFeatureSet = { | ||
'love-characters': { | ||
name: 'love-characters', | ||
status: EFeatureStatus.active, | ||
version: '0.0.1', | ||
abilities: defaultAbilities, | ||
}, | ||
}; | ||
|
||
export const RMServiceSchema: IServiceUserAmbiRelation = { | ||
name: EServiceNames.SERV_RM, | ||
type: EServiceTypes.RM, | ||
createdOn: new Date(), | ||
status: EServiceStatus.active, | ||
statusModified: new Date(), | ||
version: '1.0.0', | ||
features: defaultRMFeatures, | ||
}; | ||
|
||
export const defaultServices = { | ||
[EServiceNames.SERV_RM]: RMServiceSchema, | ||
}; | ||
|
||
export const defaultProjects = { | ||
[EServiceNames.SERV_RM]: { | ||
name: 'myorg-default-rm-index', | ||
status: 'active', | ||
/* | ||
to-finish: walk the default services | ||
service: defaultServices.get(‘rickmorty’).name, | ||
sid: unknown (NEEDS DEFINE RELATIONS) | ||
*/ | ||
}, | ||
}; | ||
|
||
export const _OrgSchema: OrgDecoration = { | ||
name: DEFAULT_ORG, | ||
members: [], | ||
services: { | ||
enabled: defaultServices, | ||
available: defaultServices, | ||
}, | ||
projects: { | ||
active: defaultProjects, | ||
}, | ||
rickmorty_meta: { | ||
favorites: { | ||
characters: [] as INCharacter['id'][], | ||
}, | ||
}, | ||
}; |
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 @@ | ||
// relations.ts | ||
import { EUserOrgRoles } from '@constants'; | ||
import { defaultAbilities } from '@schema/user'; | ||
import { defaultProjects, defaultServices } from '@schema/org'; | ||
|
||
export const defaultOrgMemberRelation = { | ||
role: [EUserOrgRoles.MEMBER], | ||
abilities: defaultAbilities, | ||
services: defaultServices, | ||
projects: defaultProjects, | ||
org: 'name', | ||
user: 'email', | ||
}; |
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,27 @@ | ||
// user.ts | ||
/* schemas */ | ||
import type { IFuzzyAbilities, UserDecoration, INCharacter, DUserOrgAmbiRelation } from '@types'; | ||
import { EUserOrgRoles, EAbilityStatus } from '@constants'; | ||
import { defaultRMActions } from '@schema/org'; | ||
|
||
/* to finish, use hashmap */ | ||
export const defaultAbilities: IFuzzyAbilities = [ | ||
{ | ||
name: 'like-stuff', | ||
contexts: ['all'], | ||
actions: defaultRMActions, | ||
roles: [EUserOrgRoles.EVERYONE], | ||
restrictions: {}, | ||
allowances: {}, | ||
status: EAbilityStatus.active, | ||
}, | ||
]; | ||
|
||
export const _UserSchema: UserDecoration = { | ||
rickmorty: { | ||
favorites: { | ||
characters: [] as INCharacter['id'][], | ||
}, | ||
}, | ||
organizations: [] as DUserOrgAmbiRelation[], | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's finish the walk