fix: update cSpell.words in settings.json and improve code formatting in various files
This commit is contained in:
Vendored
+1
-1
@@ -4,5 +4,5 @@
|
|||||||
"mode": "auto"
|
"mode": "auto"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"cSpell.words": ["mantine", "Menlo", "mgmt", "Millis", "Pandang", "Segoe", "Ujung", "VITE", "WITA"]
|
"cSpell.words": ["dtos", "mantine", "Menlo", "mgmt", "Millis", "Pandang", "Segoe", "TDTO", "Ujung", "VITE", "WITA"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,7 @@ import type { BaseEntity } from './types';
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export interface IDataTransformer<
|
export interface IDataTransformer<TEntity extends BaseEntity = BaseEntity, TDTO = TEntity> {
|
||||||
TEntity extends BaseEntity = BaseEntity,
|
|
||||||
TDTO = TEntity,
|
|
||||||
> {
|
|
||||||
/**
|
/**
|
||||||
* Transform an API DTO into a domain entity.
|
* Transform an API DTO into a domain entity.
|
||||||
*
|
*
|
||||||
@@ -88,7 +85,7 @@ export interface IDataTransformer<
|
|||||||
*
|
*
|
||||||
* Extends the core `IDataTransformer` contract with granular hooks
|
* Extends the core `IDataTransformer` contract with granular hooks
|
||||||
* for each CRUD operation. Override only the hooks you need —
|
* for each CRUD operation. Override only the hooks you need —
|
||||||
* unoverridden hooks delegate to the core `transformToEntity` /
|
* un overridden hooks delegate to the core `transformToEntity` /
|
||||||
* `transformToDTO` methods.
|
* `transformToDTO` methods.
|
||||||
*
|
*
|
||||||
* **Design rationale (from legacy analysis):**
|
* **Design rationale (from legacy analysis):**
|
||||||
@@ -129,10 +126,8 @@ export interface IDataTransformer<
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export abstract class BaseDataTransformer<
|
export abstract class BaseDataTransformer<TEntity extends BaseEntity = BaseEntity, TDTO = TEntity>
|
||||||
TEntity extends BaseEntity = BaseEntity,
|
implements IDataTransformer<TEntity, TDTO>
|
||||||
TDTO = TEntity,
|
|
||||||
> implements IDataTransformer<TEntity, TDTO>
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Core DTO → Entity transformation.
|
* Core DTO → Entity transformation.
|
||||||
|
|||||||
@@ -3,7 +3,14 @@ import type { UseBoundStore, StoreApi } from 'zustand';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useTranslation } from '@repo/core-i18n';
|
import { useTranslation } from '@repo/core-i18n';
|
||||||
import { BaseEntity, BaseRemoteDataServices } from '@repo/core-api/data-services';
|
import { BaseEntity, BaseRemoteDataServices } from '@repo/core-api/data-services';
|
||||||
import { ConfigSlice, ModuleConfigEntity, SinglePageFormState, SinglePageModalState, EnterpriseModuleState, PrivilegeEntity } from '../entities/entity';
|
import {
|
||||||
|
ConfigSlice,
|
||||||
|
ModuleConfigEntity,
|
||||||
|
SinglePageFormState,
|
||||||
|
SinglePageModalState,
|
||||||
|
EnterpriseModuleState,
|
||||||
|
PrivilegeEntity,
|
||||||
|
} from '../entities/entity';
|
||||||
import {
|
import {
|
||||||
EnterpriseConfigContext,
|
EnterpriseConfigContext,
|
||||||
EnterpriseDataServiceContext,
|
EnterpriseDataServiceContext,
|
||||||
@@ -17,7 +24,7 @@ import { Forbidden } from '../../../components';
|
|||||||
|
|
||||||
export interface EnterpriseModuleProviderProps<
|
export interface EnterpriseModuleProviderProps<
|
||||||
E extends BaseEntity,
|
E extends BaseEntity,
|
||||||
S extends EnterpriseModuleState<E> = EnterpriseModuleState<E>
|
S extends EnterpriseModuleState<E> = EnterpriseModuleState<E>,
|
||||||
> {
|
> {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
config: ModuleConfigEntity<E>;
|
config: ModuleConfigEntity<E>;
|
||||||
@@ -30,7 +37,7 @@ const IS_MACOS = typeof navigator !== 'undefined' && /Mac|iPod|iPhone|iPad/.test
|
|||||||
|
|
||||||
export function EnterpriseModuleProvider<
|
export function EnterpriseModuleProvider<
|
||||||
E extends BaseEntity,
|
E extends BaseEntity,
|
||||||
S extends EnterpriseModuleState<E> = EnterpriseModuleState<E>
|
S extends EnterpriseModuleState<E> = EnterpriseModuleState<E>,
|
||||||
>(props: EnterpriseModuleProviderProps<E, S>) {
|
>(props: EnterpriseModuleProviderProps<E, S>) {
|
||||||
const { children, config, dataServices, store } = props;
|
const { children, config, dataServices, store } = props;
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -42,8 +49,8 @@ export function EnterpriseModuleProvider<
|
|||||||
const storePrivileges = store((state: S) => state.privileges);
|
const storePrivileges = store((state: S) => state.privileges);
|
||||||
|
|
||||||
const configSlice: ConfigSlice = useMemo(() => {
|
const configSlice: ConfigSlice = useMemo(() => {
|
||||||
// FIXME => Parsing privilege: mapping string array dari store ke format PrivilegeEntity (boolean)
|
// Parsing privilege: mapping string array from store to PrivilegeEntity format (boolean)
|
||||||
const parsedPrivileges = defaultPrivileges
|
const parsedPrivileges: PrivilegeEntity = defaultPrivileges;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
config,
|
config,
|
||||||
|
|||||||
Reference in New Issue
Block a user