Skip to content

Commit

Permalink
Refactoring and restructuring of folders
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelPelegrina committed Apr 24, 2024
1 parent 92acbc9 commit c241084
Show file tree
Hide file tree
Showing 34 changed files with 95 additions and 123 deletions.
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { BooksHeaderComponent } from './components/catalog/books-header/books-he
import { CatalogComponent } from './components/catalog/catalog.component';
import { HeaderComponent } from './components/header/header.component';
import { LoginComponent } from './components/user/login/login.component';
import { SearchBarComponent } from './shared/components/search-bar/search-bar.component';
import { SearchBarComponent } from './components/search-bar/search-bar.component';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { FiltersComponent } from './components/catalog/filters/filters.component';
Expand Down Expand Up @@ -60,7 +60,7 @@ import { ButtonGroupComponent } from './components/cart/button-group/button-grou
import { NgxPermissionsModule } from 'ngx-permissions';
import { FooterComponent } from './components/footer/footer.component';
import { BookExcelParserComponent } from './components/book/book-excel-parser/book-excel-parser.component';
import { WholeNumberDirective } from './shared/utils/directives/whole-number.directive';
import { WholeNumberDirective } from './shared/utils/directives/wholeNumber.directive';

@NgModule({
declarations: [
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Subscription } from 'rxjs';
import { BookService } from 'src/app/services/book/book.service';
import { BookFormatService } from 'src/app/services/book/format/book-format.service';
import { BookGenreService } from 'src/app/services/book/genre/book-genre.service';
import { AbstractForm } from 'src/app/shared/components/abstract-form';
import { AbstractForm } from 'src/app/components/abstract/abstract-form';
import { allowedImageExtensions, requiredFileType } from 'src/app/shared/utils/required-file-type';
import { getBase64, informUserOfError } from 'src/app/shared/utils/utils';

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/book/list-book/list-book.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { map, merge, Observable, startWith, Subscription, switchMap } from 'rxjs';
import { BookService } from 'src/app/services/book/book.service';
import { SearchBarComponent } from 'src/app/shared/components/search-bar/search-bar.component';
import { SearchBarComponent } from 'src/app/components/search-bar/search-bar.component';
import { Book } from 'src/app/shared/domain/book/book';
import { ANIMATION_DURATION, StringValues } from 'src/app/shared/utils/string-values';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DeliveryMethodService } from 'src/app/services/order/delivery-method/de
import { OrderStatusService } from 'src/app/services/order/order-status/order-status.service';
import { PaymentMethodService } from 'src/app/services/order/payment-method/payment-method.service';
import { PaymentStatusService } from 'src/app/services/order/payment-status/payment-status.service';
import { AbstractForm } from 'src/app/shared/components/abstract-form';
import { AbstractForm } from 'src/app/components/abstract/abstract-form';
import { DeliveryMethod } from 'src/app/shared/domain/order/delivery-method/delivery-method';
import { OrderStatus } from 'src/app/shared/domain/order/order-status/order-status';
import { PaymentMethod } from 'src/app/shared/domain/order/payment-method/payment-method';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CartService } from 'src/app/services/cart/cart.service';
import { OrderStatusService } from 'src/app/services/order/order-status/order-status.service';
import { OrderService } from 'src/app/services/order/order.service';
import { PaymentStatusService } from 'src/app/services/order/payment-status/payment-status.service';
import { SearchBarComponent } from 'src/app/shared/components/search-bar/search-bar.component';
import { SearchBarComponent } from 'src/app/components/search-bar/search-bar.component';
import { Order } from 'src/app/shared/domain/order/order';
import { OrderStatus } from 'src/app/shared/domain/order/order-status/order-status';
import { PaymentStatus } from 'src/app/shared/domain/order/payment-status/payment-status';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Observable, Subscription, map, merge, startWith, switchMap } from 'rxjs';
import { UserService } from 'src/app/services/user/user.service';
import { SearchBarComponent } from 'src/app/shared/components/search-bar/search-bar.component';
import { SearchBarComponent } from 'src/app/components/search-bar/search-bar.component';
import { User } from 'src/app/shared/domain/user/user';
import { ANIMATION_DURATION, StringValues } from 'src/app/shared/utils/string-values';
import { informUserOfError } from 'src/app/shared/utils/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PostalCodeService } from 'src/app/services/postal-code/postal-code.serv
import { Country } from '../../../../shared/domain/country/country';
import { City } from '../../../../shared/domain/user/address/postal-code/city/city';
import { PostalCode } from '../../../../shared/domain/user/address/postal-code/postal-code';
import { AbstractForm } from 'src/app/shared/components/abstract-form';
import { AbstractForm } from 'src/app/components/abstract/abstract-form';

/**
* Component for adding or editing address information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FormGroup, FormGroupDirective } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { Subscription } from 'rxjs';
import { UserService } from 'src/app/services/user/user.service';
import { AbstractForm } from 'src/app/shared/components/abstract-form';
import { AbstractForm } from 'src/app/components/abstract/abstract-form';

/**
* Component for adding or editing user information.
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/user/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
import { AuthService } from '../../../services/auth/auth.service';
import { Router } from '@angular/router';
import { AbstractForm } from 'src/app/shared/components/abstract-form';
import { AbstractForm } from 'src/app/components/abstract/abstract-form';
import { NgxPermissionsService } from 'ngx-permissions';
import { AuthUtils } from 'src/app/shared/utils/auth-utils';
import { informUserOfError } from 'src/app/shared/utils/utils';
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/user/profile/profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { jwtDecode } from 'jwt-decode';
import { Subscription } from 'rxjs';
import { AuthService } from 'src/app/services/auth/auth.service';
import { UserService } from 'src/app/services/user/user.service';
import { AbstractForm } from 'src/app/shared/components/abstract-form';
import { AbstractForm } from 'src/app/components/abstract/abstract-form';
import { Address } from 'src/app/shared/domain/user/address/address';
import { User } from 'src/app/shared/domain/user/user';
import { AuthResultDto } from 'src/app/shared/utils/interfaces/authResultDto';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TestBed } from '@angular/core/testing';

import { AbstractService } from './abstract.service';
import { Country } from '../domain/country/country';
import { Country } from '../../shared/domain/country/country';

describe('AbstractService', () => {
let service: AbstractService<Country, string>;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/services/address/address.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Address } from 'src/app/shared/domain/user/address/address';
import { AbstractService } from 'src/app/shared/service/abstract.service';
import { AbstractService } from 'src/app/services/abstract/abstract.service';
import { StringValues } from 'src/app/shared/utils/string-values';

/**
Expand Down
9 changes: 4 additions & 5 deletions src/app/services/book/book.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, catchError } from 'rxjs';
import { Book } from 'src/app/shared/domain/book/book';
import { AbstractService } from 'src/app/shared/service/abstract.service';
import { QueryBuilderService } from 'src/app/shared/service/query-builder.service';
import { AbstractService } from 'src/app/services/abstract/abstract.service';
import { StringValues } from 'src/app/shared/utils/string-values';
import { buildQueryParams } from 'src/app/shared/utils/utils';

/**
* A service for managing book-related operations.
Expand All @@ -21,8 +21,7 @@ export class BookService extends AbstractService<Book, number> {
* @param queryBuilderService - The service for building query parameters.
*/
constructor(
protected override httpClient: HttpClient,
private queryBuilderService: QueryBuilderService
protected override httpClient: HttpClient
) {
super(StringValues.BASE_BOOK_URL, httpClient);
}
Expand Down Expand Up @@ -58,7 +57,7 @@ export class BookService extends AbstractService<Book, number> {
size?: number,
genre?: string
): Observable<any> {
const queryParams = this.queryBuilderService.buildQueryParams({
const queryParams = buildQueryParams({
active,
name: filter,
sortType,
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/book/format/book-format.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { BookFormat } from 'src/app/shared/domain/book/parameters/book-parameters-format/book-parameters-format';
import { AbstractService } from 'src/app/shared/service/abstract.service';
import { AbstractService } from 'src/app/services/abstract/abstract.service';
import { StringValues } from 'src/app/shared/utils/string-values';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/book/genre/book-genre.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { BookGenre } from 'src/app/shared/domain/book/book-genre/book-genre';
import { AbstractService } from 'src/app/shared/service/abstract.service';
import { AbstractService } from 'src/app/services/abstract/abstract.service';
import { StringValues } from 'src/app/shared/utils/string-values';

/**
Expand Down
9 changes: 4 additions & 5 deletions src/app/services/city/city.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, catchError } from 'rxjs';
import { City } from 'src/app/shared/domain/user/address/postal-code/city/city';
import { AbstractService } from 'src/app/shared/service/abstract.service';
import { QueryBuilderService } from 'src/app/shared/service/query-builder.service';
import { AbstractService } from 'src/app/services/abstract/abstract.service';
import { StringValues } from 'src/app/shared/utils/string-values';
import { buildQueryParams } from 'src/app/shared/utils/utils';

/**
* A service for managing city-related operations.
Expand All @@ -20,8 +20,7 @@ export class CityService extends AbstractService<City, string> {
* @param queryBuilderService - The service for building query parameters.
*/
constructor(
protected override httpClient: HttpClient,
private queryBuilderService: QueryBuilderService
protected override httpClient: HttpClient
) {
super(StringValues.BASE_CITY_URL, httpClient);
}
Expand All @@ -33,7 +32,7 @@ export class CityService extends AbstractService<City, string> {
* @returns An Observable containing the list of cities matching the specified criteria.
*/
public override getAll(active?: boolean, name?: string): Observable<any> {
const queryParams = this.queryBuilderService.buildQueryParams({
const queryParams = buildQueryParams({
active,
country_name: name
});
Expand Down
9 changes: 4 additions & 5 deletions src/app/services/country/country.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Injectable } from '@angular/core';
import { StringValues } from '../../shared/utils/string-values';
import { HttpClient } from '@angular/common/http';
import { Country } from '../../shared/domain/country/country';
import { AbstractService } from '../../shared/service/abstract.service';
import { AbstractService } from '../abstract/abstract.service';
import { Observable, catchError } from 'rxjs';
import { QueryBuilderService } from 'src/app/shared/service/query-builder.service';
import { buildQueryParams } from 'src/app/shared/utils/utils';

/**
* A service for managing country-related operations.
Expand All @@ -20,8 +20,7 @@ export class CountryService extends AbstractService<Country, string> {
* @param queryBuilderService - The service for building query parameters.
*/
constructor(
protected override httpClient: HttpClient,
private queryBuilderService: QueryBuilderService
protected override httpClient: HttpClient
) {
super(StringValues.BASE_COUNTRY_URL, httpClient);
}
Expand All @@ -32,7 +31,7 @@ export class CountryService extends AbstractService<Country, string> {
* @returns An Observable containing the list of countries matching the specified criteria.
*/
public override getAll(active?: boolean): Observable<any> {
const queryParams = this.queryBuilderService.buildQueryParams({
const queryParams = buildQueryParams({
active
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, catchError } from 'rxjs';
import { DeliveryMethod } from 'src/app/shared/domain/order/delivery-method/delivery-method';
import { AbstractService } from 'src/app/shared/service/abstract.service';
import { QueryBuilderService } from 'src/app/shared/service/query-builder.service';
import { AbstractService } from 'src/app/services/abstract/abstract.service';
import { StringValues } from 'src/app/shared/utils/string-values';
import { buildQueryParams } from 'src/app/shared/utils/utils';

/**
* A service for managing delivery method-related operations.
Expand All @@ -20,8 +20,7 @@ export class DeliveryMethodService extends AbstractService<DeliveryMethod, strin
* @param queryBuilderService - The service for building query parameters.
*/
constructor(
protected override httpClient: HttpClient,
private queryBuilderService: QueryBuilderService
protected override httpClient: HttpClient
) {
super(StringValues.BASE_DELIVERY_METHODS_URL, httpClient);
}
Expand All @@ -32,7 +31,7 @@ export class DeliveryMethodService extends AbstractService<DeliveryMethod, strin
* @returns An Observable containing the list of delivery methods matching the specified criteria.
*/
public override getAll(active?: boolean): Observable<any> {
const queryParams = this.queryBuilderService.buildQueryParams({
const queryParams = buildQueryParams({
active
});

Expand Down
9 changes: 4 additions & 5 deletions src/app/services/order/order-status/order-status.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, catchError } from 'rxjs';
import { OrderStatus } from 'src/app/shared/domain/order/order-status/order-status';
import { AbstractService } from 'src/app/shared/service/abstract.service';
import { QueryBuilderService } from 'src/app/shared/service/query-builder.service';
import { AbstractService } from 'src/app/services/abstract/abstract.service';
import { StringValues } from 'src/app/shared/utils/string-values';
import { buildQueryParams } from 'src/app/shared/utils/utils';

/**
* A service for managing order status-related operations.
Expand All @@ -20,8 +20,7 @@ export class OrderStatusService extends AbstractService<OrderStatus, string> {
* @param queryBuilderService - The service for building query parameters.
*/
constructor(
protected override httpClient: HttpClient,
private queryBuilderService: QueryBuilderService
protected override httpClient: HttpClient
) {
super(StringValues.BASE_ORDER_STATUSES_URL, httpClient);
}
Expand All @@ -32,7 +31,7 @@ export class OrderStatusService extends AbstractService<OrderStatus, string> {
* @returns An Observable containing the list of order statuses matching the specified criteria.
*/
public override getAll(active?: boolean): Observable<any> {
const queryParams = this.queryBuilderService.buildQueryParams({
const queryParams = buildQueryParams({
active
});

Expand Down
9 changes: 4 additions & 5 deletions src/app/services/order/order.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Injectable } from '@angular/core';
import { Observable, catchError, throwError } from 'rxjs';
import { Order } from 'src/app/shared/domain/order/order';
import { OrderedBook } from 'src/app/shared/domain/order/ordered-book';
import { AbstractService } from 'src/app/shared/service/abstract.service';
import { QueryBuilderService } from 'src/app/shared/service/query-builder.service';
import { AbstractService } from 'src/app/services/abstract/abstract.service';
import { StringValues } from 'src/app/shared/utils/string-values';
import { buildQueryParams } from 'src/app/shared/utils/utils';

/**
* A service for managing order-related operations.
Expand All @@ -21,8 +21,7 @@ export class OrderService extends AbstractService<Order, number> {
* @param queryBuilderService - The service for building query parameters.
*/
constructor(
protected override httpClient: HttpClient,
private queryBuilderService: QueryBuilderService
protected override httpClient: HttpClient
) {
super(StringValues.BASE_ORDER_URL, httpClient);
}
Expand Down Expand Up @@ -70,7 +69,7 @@ export class OrderService extends AbstractService<Order, number> {
* @returns An Observable containing the list of orders matching the specified criteria.
*/
public override getAll(filter?: string, sortType?: string, sortProperty?: string, page?: number, size?: number): Observable<any> {
const queryParams = this.queryBuilderService.buildQueryParams({
const queryParams = buildQueryParams({
name: filter,
sortType: sortType || 'asc',
sortProperty: sortProperty || 'date',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, catchError } from 'rxjs';
import { PaymentMethod } from 'src/app/shared/domain/order/payment-method/payment-method';
import { AbstractService } from 'src/app/shared/service/abstract.service';
import { QueryBuilderService } from 'src/app/shared/service/query-builder.service';
import { AbstractService } from 'src/app/services/abstract/abstract.service';
import { StringValues } from 'src/app/shared/utils/string-values';
import { buildQueryParams } from 'src/app/shared/utils/utils';

/**
* A service for managing payment method-related operations.
Expand All @@ -20,8 +20,7 @@ export class PaymentMethodService extends AbstractService<PaymentMethod, string>
* @param queryBuilderService - The service for building query parameters.
*/
constructor(
protected override httpClient: HttpClient,
private queryBuilderService: QueryBuilderService
protected override httpClient: HttpClient
) {
super(StringValues.BASE_PAYMENT_METHODS_URL, httpClient);
}
Expand All @@ -32,7 +31,7 @@ export class PaymentMethodService extends AbstractService<PaymentMethod, string>
* @returns An Observable containing the list of payment methods matching the specified criteria.
*/
public override getAll(active?: boolean): Observable<any> {
const queryParams = this.queryBuilderService.buildQueryParams({
const queryParams = buildQueryParams({
active
});

Expand Down
Loading

0 comments on commit c241084

Please sign in to comment.