You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -210,19 +210,19 @@ This POS system is built using Clean Architecture principles for both the backen
210
210
211
211
The Domain layer is the core of the backend's clean architecture that define the data structure and business logic. There are some components in this layer :
212
212
213
-
1.`Entity`, defining the data structure that used in the use cases
214
-
2.`Usecase`, implementing the specific business rules
215
-
3.`Repository Interface`, ensuring the business logic remains independent of the data layer (e.g., databases, external API, or mock data)
213
+
1.`Entity`, defining the [data structure](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/apps/api/domain/transactions/entity.go#L19-L30) that used in the use cases
214
+
2.`Usecase`, implementing the specific [business logic](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/apps/api/domain/transactions/usecase.go#L28-L40)
215
+
3.`Repository Interface`, containing [interface](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/apps/api/domain/transactions/repository.go) that ensure the business logic remains independent of the data layer (e.g., databases, external API, or mock data)
216
216
217
217
This separation facilitates testing, allowing use cases and entities to be validated in isolation without relying on external systems, enhancing overall maintainability and scalability.
218
218
219
219
#### B. Data Layer
220
220
221
-
The Data Layer implements the repository interfaces required by the use cases, allowing for flexibility in how data is sourced and managed. By following these interfaces, the Data Layer can easily connect to various data sources, such as databases, mock data, or external APIs. This design promotes separation of concerns, enabling the backend's business logic to remain independent of the underlying data implementation.
221
+
The Data Layer [implements the repository interfaces](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/apps/api/data/mysql/transactions/repository.go) required by the use cases, allowing for flexibility in how data is sourced and managed. By following these interfaces, the Data Layer can easily connect to various data sources, such as databases, mock data, or external APIs. This design promotes separation of concerns, enabling the backend's business logic to remain independent of the underlying data implementation.
222
222
223
223
#### C. Presentation Layer
224
224
225
-
The Presentation Layer contain handler that consumes the use cases and maps the internal data structures from the entities to output formats, such as JSON for REST APIs. In this layer, the backend transforms the entity data into structures that align with the api specification, ensuring that the frontend can seamlessly consume the data.
225
+
The Presentation Layer contain [handler](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/apps/api/presentation/http/transactions/handler.go) that [consumes the use cases](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/apps/api/presentation/http/transactions/handler.go#L38) and [maps the internal data structures](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/apps/api/presentation/http/transactions/handler.go#L44-L47) from the entities to output formats, such as JSON for REST APIs. It also [map the request](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/apps/api/presentation/http/transactions/handler.go#L22-L36) from HTTP API to internal data structure
226
226
227
227
### 5.2. Frontend
228
228
@@ -232,18 +232,18 @@ The Presentation Layer contain handler that consumes the use cases and maps the
232
232
233
233
The domain layer in frontend is similar like backend, it contains the following components :
234
234
235
-
1.`Entity`, defining the internal data structures used in the business logic
236
-
2.`Usecase`, implementing the business logic, utilizing a finite state machine to map the current state to the next state based on received actions or events. Importantly, the use cases do not concern themselves with the data source, whether it comes from an API or mock data; they only recognize the interfaces. Additionally, this layer is agnostic to the frontend framework, ensuring that no framework-specific code (e.g., React) is present. Instead, the business logic is written purely in TypeScript, focusing on the finite state machine's functionality.
237
-
3.`Repository Interface`, containing interface that define the data source that used in the use case, for example fetch, create, update, and delete data.
235
+
1.`Entity`, defining the [internal data structures](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/libs/ui/src/domain/entities/Transaction.ts) used in the business logic
236
+
2.`Usecase`, implementing the business logic, utilizing a [finite state machine](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/libs/ui/src/domain/usecases/transactionList.ts#L80-L150) to map the current state to the next state based on received actions. Importantly, the use cases do not concern themselves with the data source, whether it comes from an API or mock data; they only [recognize the interfaces](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/libs/ui/src/domain/usecases/transactionList.ts#L161-L162). Additionally, this layer is agnostic to the frontend framework, ensuring that no framework-specific code (e.g., React) is present.
237
+
3.`Repository Interface`, containing [interface](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/libs/ui/src/domain/repositories/transaction.ts) that define the data source that used in the use case, for example fetch, create, update, and delete data.
238
238
239
239
#### B. Data Layer
240
240
241
-
The Data Layer implements the interfaces used in the use case layer, allowing it to determine the data source, whether from an API or mock data. This design enables easy testing of the use cases using mock data without altering the underlying logic. Additionally, the Data Layer is responsible for transforming the API data structures into the entity data structures utilized in the use cases.
241
+
The Data Layer [implements the interfaces](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/libs/ui/src/data/openApi/transaction.ts) used in the use case layer, allowing it to determine the data source, whether from an API or mock data. This design enables easy testing of the use cases using mock data without altering the underlying logic. Additionally, the Data Layer is responsible for transforming the API data structures into the entity data structures utilized in the use cases.
242
242
243
243
#### C. Presentation Layer
244
244
245
245
Presentation layer will consumes the logic from usecase layer and output it to UI. It consist of the following components :
246
246
247
-
1.`Controller`, consumes the finite state machine defined in the use case layer and integrates it into the framework's state management. For instance, in React, this is achieved using `useReducer` to manage state transitions and useEffect to handle side effects of the finite state machine.
248
-
2.`Presentor`, this layer is responsible for mapping the data structures from the entities to the UI props used in the components, ensuring that the frontend displays the appropriate information in a user-friendly manner.
249
-
3.`View`, this layer is responsible for defining the user interface, in React, it will contains JSX of the components
247
+
1.`Controller`, consumes the finite state machine defined in the use case layer and [integrates it into the framework's state management](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/libs/ui/src/presentation/controllers/controller.ts). For instance, in React, this is achieved using `useReducer` to manage state transitions and useEffect to handle side effects of the finite state machine.
248
+
2.`Presenter`, this layer is responsible for [mapping the data structures](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/libs/ui/src/presentation/views/transactions/widgets/TransactionList/TransactionList.presenter.tsx#L24) from the entities to the UI props used in the components, ensuring that the frontend displays the appropriate information in a user-friendly manner.
249
+
3.`View`, this layer is responsible for [defining the user interface](https://github.com/gatherloop/gatherloop-pos/blob/3a42e3c6956871b779d1b0b085df746f402d1684/libs/ui/src/presentation/views/transactions/widgets/TransactionList/TransactionList.view.tsx), in React, it will contains JSX of the components
0 commit comments