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 107: Refactor Backend Structure #141

Merged
merged 1 commit into from
May 30, 2024

Conversation

daniel-va
Copy link
Contributor

@daniel-va daniel-va commented May 29, 2024

Resolves #107, resolves #129.

Restructures the backend (server-asset-sg) by feature.

  • Most types have been moved from fp-ts into normal TypeScript interfaces. The main exceptions to this are asset-edit (now found in the asset-old feature) and the OCR file api.
  • All API routes have been refactored using RESTful standards and moved into matching feature controllers. The old routes remain available within the AppController, since the frontend still depends on it.
  • Common behaviour related to database access has been moved into each respective feature's *.repo.ts file.

@daniel-va daniel-va requested a review from TIL-EBP May 29, 2024 06:07
@daniel-va daniel-va self-assigned this May 29, 2024
@daniel-va daniel-va mentioned this pull request May 29, 2024
@daniel-va daniel-va force-pushed the feature/asset-107-backend-ordnerstruktur branch from a5875a2 to 6cacb79 Compare May 30, 2024 06:22
Copy link
Contributor

Choose a reason for hiding this comment

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

IS this file/ the entire feature still required? now that the search is in the features/assets/search?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Until #99 is finished, the old search is still in use. We will most likely need a cleanup issue afterwards to remove things like this file, but for now, it's still required.

static parse(value: string): LocalDate {
const parts = value.split('-');
if (parts.length !== 3) {
throw new Error(`failed to parse LocalDate (expected 3 parts, but got ${parts})`);
Copy link
Contributor

Choose a reason for hiding this comment

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

parts.length?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.


private constructor(date: Date) {
this.year = date.getFullYear();
this.month = date.getMonth() + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

why -1 and then +1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

JavaScript's Date stores the month with a zero-based index (e.g. January = 0, December = 11, etc.). Everything else, i.e. days and years, are one-based. To use the same system for all three components, I increase the month when storing it in LocalDate.

# Conflicts:
#	apps/server-asset-sg/project.json
#	package.json

Move app routes into specific features

Collect user CRUD operations in `UserRepo`

Update NestJs to `10.x`

Add role guard

Move user APIs into `/api/users` path

Move contact routes into `/api/contacts`

Refactor asset API

Move NestJS utils into ` core`

Fix `ElasticSearchAsset.titleOriginal` not supporting `null` values

Fix `LocalDate.parse` error message
@daniel-va daniel-va force-pushed the feature/asset-107-backend-ordnerstruktur branch from b01c8b0 to dc513da Compare May 30, 2024 11:49
@daniel-va daniel-va merged commit d9a9661 into develop May 30, 2024
10 checks passed
@daniel-va daniel-va deleted the feature/asset-107-backend-ordnerstruktur branch May 30, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update package Prisma Backend Ordnerstruktur neu organisieren
2 participants