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

✨ 374 New File Names #382

Conversation

xoscar
Copy link
Collaborator

@xoscar xoscar commented Apr 28, 2022

This PR is the first PR based on the documentation https://kubeshop.atlassian.net/wiki/spaces/KUBESHOP/pages/486309895/Post+MVP+Frontend+Improvements that updates the front end architecture to be more flexible and scalable.

Changes

  • Introduces a new pattern for file names depending on the type.
  • Divides resource spaces into entities and their own folder.
  • Adds the gateways folder and pattern for I/O.
  • Introduces a standard way of adding types.

Fixes

  • Duplicated types.
  • Unused types.

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

@xoscar xoscar changed the title 374 adding entities folder + new file names ✨ 374 Adding Entities Folder & New File Names Apr 28, 2022
testId: string;
trace: ITrace;
assertion?: Assertion;
trace: TTrace;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not going to use interfaces anymore, we are going to be using types for the whole of the FE app and it should always be starting with a T

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we are moving away from interfaces? https://ncjamieson.com/prefer-interfaces/

@@ -0,0 +1,2 @@
// eslint-disable-next-line no-restricted-exports
export {default} from './Router';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the Router under the components folder

import {
useGetTestByIdQuery,
useGetTestResultByIdQuery,
useRunTestMutation,
useUpdateTestResultMutation,
} from 'redux/services/TestService';
} from 'gateways/Test.gateway';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This are now coming from the gateway file

@@ -0,0 +1,22 @@
export const BASE_URL = 'http://localhost:8080';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introducing constants files

import {escapeString} from '../utils';
import {getSpanValue} from './SpanService';

const getOperator = (op: COMPARE_OPERATOR) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this to the Operator Service

@@ -0,0 +1,57 @@
import {CompareOperator} from '../Operator/Operator.constants';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Types are now defined under each of the entities

@@ -11,7 +11,7 @@ type TTour = Record<GuidedTours, boolean>;

const GUIDED_TOUR_KEY = 'guided_tour';

const {get, set} = LocalStorageService<TTour>(GUIDED_TOUR_KEY);
const {get, set} = LocalStorageGateway<TTour>(GUIDED_TOUR_KEY);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gateways = I/O
Services = Business logic

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@@ -0,0 +1,13 @@
import {CompareOperator, CompareOperatorNameMap, CompareOperatorSymbolMap} from './Operator.constants';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving forward services will be static functions that provide an object with methods and attributes. This allows the possibility of composing if required.

@xoscar xoscar marked this pull request as ready for review April 28, 2022 15:58
@xoscar xoscar changed the title ✨ 374 Adding Entities Folder & New File Names ✨ 374 New File Names Apr 29, 2022
@xoscar xoscar merged commit 03e78e0 into main Apr 29, 2022
@xoscar xoscar deleted the 374-post-mvp-improvements-naming-conventions-for-files-encapsulating-entities branch April 29, 2022 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Post MVP Improvements] Naming conventions for files & Encapsulating entities
3 participants