Skip to content
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

Feature/user management #50

Merged
merged 51 commits into from
Jun 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
733a53f
chore: Add user role GraphQL fragment and user read query
yosvelquintero Jun 6, 2024
1c8d4ee
chore: Update user interface to include user roles
yosvelquintero Jun 6, 2024
f23532c
chore: Remove '__typename' from interfaces
yosvelquintero Jun 6, 2024
db22c49
chore: Gereated GraphQL code
yosvelquintero Jun 6, 2024
4fd7729
chore: Update user service with read and mutate methods
yosvelquintero Jun 6, 2024
a90e9aa
chore: Added margin button
yosvelquintero Jun 6, 2024
699abb5
chore: Add State IAM management module and related files
yosvelquintero Jun 6, 2024
2f93361
chore: Add IAM state types
yosvelquintero Jun 6, 2024
9830d1d
chore: Update IAM router paths and titles
yosvelquintero Jun 6, 2024
1aff2c8
chore: Move fulfillment form building functions to lib directory
yosvelquintero Jun 6, 2024
2f58097
chore: Move invoice form building functions to lib directory
yosvelquintero Jun 6, 2024
8d028e5
chore: Move order form building functions to lib directory
yosvelquintero Jun 6, 2024
b4c759e
chore: Move product form building functions to lib directory
yosvelquintero Jun 6, 2024
b50e275
chore: Refactor code and IAM management view
yosvelquintero Jun 7, 2024
bc425dc
chore: Add user service for managing user-related functionality
yosvelquintero Jun 7, 2024
c6dce60
chore: Add description field to user role and timezone fragments
yosvelquintero Jun 7, 2024
729e3eb
chore: Update IAM router paths and titles
yosvelquintero Jun 7, 2024
ea5108b
chore: Update user full name in IAM effects
yosvelquintero Jun 7, 2024
047b794
chore: Add "type:shared" to .eslintrc.json
yosvelquintero Jun 7, 2024
b35cb98
chore: Update country component selector
yosvelquintero Jun 7, 2024
1c33434
chore: Todo localization data schema with correct timezone value
yosvelquintero Jun 7, 2024
701e5a9
feat: Add user role enum and update user interface
yosvelquintero Jun 7, 2024
be73e0a
feat: Update IAM components for user management
yosvelquintero Jun 7, 2024
f1c9a29
refactor: Moved user utils code to store user service
yosvelquintero Jun 7, 2024
e005c71
chore: Refactor country form to use destructured options in buildCoun…
yosvelquintero Jun 7, 2024
7117c35
chore: Remove unused startWith operator in preferences component
yosvelquintero Jun 7, 2024
e15942f
feat: Update IAM components
yosvelquintero Jun 7, 2024
d02a36f
chore: Update timezone value
yosvelquintero Jun 12, 2024
4cf2958
feat: Add 'value' field to TimezoneFragment
yosvelquintero Jun 12, 2024
61b5ca6
chore: Add 'value' field
yosvelquintero Jun 12, 2024
f091402
chore: Generated GraphQL code
yosvelquintero Jun 12, 2024
5ebee3f
chore: : Add countryReadOneByIdRequest action
yosvelquintero Jun 12, 2024
e1cfcbe
chore: Add userReadOneByIdRequest action
yosvelquintero Jun 12, 2024
a994bdb
chore: Add orderReadOneByIdRequest action
yosvelquintero Jun 12, 2024
0efda56
chore: Add productReadOneByIdRequest action
yosvelquintero Jun 12, 2024
1c89ee1
chore: Request ony by ide on view details
yosvelquintero Jun 12, 2024
14f234a
chore: Add error handling for unauthorized requests
yosvelquintero Jun 12, 2024
0e6bef0
chore: Code refactor
yosvelquintero Jun 12, 2024
d1ca783
chore: Update forms.scss with VCL theme usage and styling improvements
yosvelquintero Jun 19, 2024
dc14369
chore: Code refactor
yosvelquintero Jun 19, 2024
267b633
chore: Add role management components and update routing
yosvelquintero Jun 19, 2024
8bff84f
chore: Add role management components and update routing
yosvelquintero Jun 19, 2024
01da8bf
feat: Add role-related GraphQL fragments and mutations
yosvelquintero Jun 19, 2024
ea5ce78
chore: GraphQL generated code
yosvelquintero Jun 19, 2024
3d65cd1
chore: Add Role state and services
yosvelquintero Jun 19, 2024
bc3f677
refactor: Update IAM views
yosvelquintero Jun 19, 2024
d3184db
refactor: Update Country views
yosvelquintero Jun 19, 2024
3e1f756
refactor: Module Fulfillment
yosvelquintero Jun 19, 2024
211dbaf
refactor: Module Fulfillment
yosvelquintero Jun 19, 2024
cd100b1
refactor: Module Fulfillment
yosvelquintero Jun 19, 2024
23c5dd6
refactor: Module UI
yosvelquintero Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Add productReadOneByIdRequest action
yosvelquintero committed Jun 12, 2024
commit 0efda567948ae97ebc735a63f96d6af9cfd0058f
15 changes: 15 additions & 0 deletions packages/core/state/src/lib/+state/product/product.actions.ts
Original file line number Diff line number Diff line change
@@ -26,6 +26,21 @@ export const productReadRequestFail = createAction(
props<{ error: string }>()
);

export const productReadOneByIdRequest = createAction(
'[PRODUCT] Read one by id request',
props<{ payload: { id: string } }>()
);

export const productReadOneByIdRequestSuccess = createAction(
'[PRODUCT] Read one by id success',
props<{ payload: IProduct }>()
);

export const productReadOneByIdRequestFail = createAction(
'[PRODUCT] Read one by id fail',
props<{ error: string }>()
);

export const setSelectedId = createAction(
'[PRODUCT] Set selected id',
props<{ payload: string | null }>()
51 changes: 49 additions & 2 deletions packages/core/state/src/lib/+state/product/product.effects.ts
Original file line number Diff line number Diff line change
@@ -2,9 +2,13 @@ import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, map, switchMap, tap } from 'rxjs/operators';
import { catchError, exhaustMap, map, switchMap, tap } from 'rxjs/operators';

import { ROUTER } from '@console-core/config';
import {
IoRestorecommerceResourcebaseFilterOperation,
IoRestorecommerceResourcebaseFilterValueType,
} from '@console-core/graphql';
import {
ENotificationTypes,
IProduct,
@@ -15,14 +19,15 @@ import { ErrorHandlingService, ProductService } from '../../services';
import { AppFacade } from '../app';

import * as productActions from './product.actions';
import { productReadOneByIdRequest } from './product.actions';

@Injectable()
export class ProductEffects {
productReadRequest$ = createEffect(() => {
let isLoadMore = false;
return this.actions$.pipe(
ofType(productActions.productReadRequest),
switchMap(({ payload }) =>
exhaustMap(({ payload }) =>
this.productService.read(payload).pipe(
tap((result) => {
if (payload.offset) {
@@ -53,6 +58,47 @@ export class ProductEffects {
);
});

productReadOneByIdRequest$ = createEffect(() => {
return this.actions$.pipe(
ofType(productReadOneByIdRequest),
exhaustMap(({ payload }) =>
this.productService
.read({
filters: [
{
filters: [
{
field: 'id',
value: payload.id,
type: IoRestorecommerceResourcebaseFilterValueType.String,
operation: IoRestorecommerceResourcebaseFilterOperation.Eq,
},
],
},
],
limit: 1,
})
.pipe(
map((result) => {
const payload =
result?.data?.catalog?.product?.Read?.details?.items?.pop()
?.payload as IProduct;
return productActions.productReadOneByIdRequestSuccess({
payload,
});
}),
catchError((error: Error) =>
of(
productActions.productReadOneByIdRequestFail({
error: error.message,
})
)
)
)
)
);
});

productCreateRequest$ = createEffect(() => {
return this.actions$.pipe(
ofType(productActions.productCreateRequest),
@@ -185,6 +231,7 @@ export class ProductEffects {
return this.actions$.pipe(
ofType(
productActions.productReadRequestFail,
productActions.productReadOneByIdRequestFail,
productActions.productCreateFail,
productActions.productUpdateFail,
productActions.productRemoveFail
2 changes: 2 additions & 0 deletions packages/core/state/src/lib/+state/product/product.facade.ts
Original file line number Diff line number Diff line change
@@ -32,6 +32,8 @@ export class ProductFacade {
// Actions
read = (payload: IIoRestorecommerceResourcebaseReadRequest) =>
this.store.dispatch(productActions.productReadRequest({ payload }));
readOneById = (payload: { id: string }) =>
this.store.dispatch(productActions.productReadOneByIdRequest({ payload }));
setSelectedId = (payload: string | null) =>
this.store.dispatch(productActions.setSelectedId({ payload }));
create = (payload: IIoRestorecommerceProductProductList) =>
23 changes: 23 additions & 0 deletions packages/core/state/src/lib/+state/product/product.reducer.ts
Original file line number Diff line number Diff line change
@@ -42,6 +42,29 @@ const reducer = createReducer<IProductState>(
error,
})
),
on(
productActions.productReadOneByIdRequest,
(state): IProductState => ({
...state,
actionStatus: EActionStatus.Requesting,
})
),
on(
productActions.productReadOneByIdRequestSuccess,
(state, { payload }): IProductState =>
adapter.addOne(payload, {
...state,
actionStatus: EActionStatus.Succeeded,
})
),
on(
productActions.productReadOneByIdRequestFail,
(state, { error }): IProductState => ({
...state,
actionStatus: EActionStatus.Failed,
error,
})
),
on(
productActions.setSelectedId,
(state, { payload }): IProductState => ({