diff --git a/angular/RestClient/src/app/core/models/Booking.interface.ts b/angular/RestClient/src/app/core/models/Booking.interface.ts deleted file mode 100644 index e4b65d2d1c8718b6dcb3860446cd9451a5f025c2..0000000000000000000000000000000000000000 --- a/angular/RestClient/src/app/core/models/Booking.interface.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Room } from './Room.interface'; -import { User } from './User.interface'; - -export interface Booking { - id: number; - start: Date; - end: Date; - userId: User; - roomId: Room; -} diff --git a/angular/RestClient/src/app/core/models/Room.interface.ts b/angular/RestClient/src/app/core/models/Room.interface.ts deleted file mode 100644 index a00b1e53c6ad8312f0f2edf78a99c891c4506716..0000000000000000000000000000000000000000 --- a/angular/RestClient/src/app/core/models/Room.interface.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type RoomType = 'SINGLE' | 'DOUBLE' | 'SUITE'; - -export const roomTypeArray: RoomType[] = ['SINGLE', 'DOUBLE', 'SUITE']; - -export interface Room { - id: number; - roomNumber: String; - type: RoomType; - available: boolean; -} diff --git a/angular/RestClient/src/app/core/models/Route.interface.ts b/angular/RestClient/src/app/core/models/Route.interface.ts index ad601f7779b195c132a1cde2f711fc27b9622ab8..69ba0f2e9a0e8d9b729e47a155c9ccc1e902250d 100644 --- a/angular/RestClient/src/app/core/models/Route.interface.ts +++ b/angular/RestClient/src/app/core/models/Route.interface.ts @@ -1,5 +1,5 @@ import { Route } from '@angular/router'; -import { UserRol } from './User.interface'; +import { UserRol } from '../../features/users/types/User.interface'; type RolledRoute = { expectedRole?: UserRol | UserRol[]; diff --git a/angular/RestClient/src/app/core/models/Session.interface.ts b/angular/RestClient/src/app/core/models/Session.interface.ts index 59c7781b33b4275813576b9620cc8c80657c6042..8afb809bc75590f009ad4c1d7f934d546e855103 100644 --- a/angular/RestClient/src/app/core/models/Session.interface.ts +++ b/angular/RestClient/src/app/core/models/Session.interface.ts @@ -1,4 +1,4 @@ -import { UserRol } from './User.interface'; +import { UserRol } from '../../features/users/types/User.interface'; export interface Session { id: number; diff --git a/angular/RestClient/src/app/core/models/User.interface.ts b/angular/RestClient/src/app/core/models/User.interface.ts deleted file mode 100644 index 3854af0d5782e5fd5ff36412f94bd73c998b50c3..0000000000000000000000000000000000000000 --- a/angular/RestClient/src/app/core/models/User.interface.ts +++ /dev/null @@ -1,25 +0,0 @@ -export interface User { - id: number; - name: string; - email: String; - rol: UserRol; -} - -export interface Client extends User { - status: UserState; - // bookings: number[] // Booking[] -} - -export interface HotelAdmin extends User { - // hotels: number[] // Hotel[] -} - -export type UserRol = 'ADMIN' | 'CLIENT' | 'HOTEL_ADMIN'; -export const UserRolesArray: UserRol[] = ['CLIENT', 'HOTEL_ADMIN', 'ADMIN']; - -export type UserStateFilter = 'All' | UserState; - -export type UserState = - | 'NO_BOOKINGS' - | 'WITH_ACTIVE_BOOKINGS' - | 'WITH_INACTIVE_BOOKINGS'; diff --git a/angular/RestClient/src/app/core/models/index.ts b/angular/RestClient/src/app/core/models/index.ts deleted file mode 100644 index 311b36b9fe22a4aa133d6cf0ec105a301eb89bd6..0000000000000000000000000000000000000000 --- a/angular/RestClient/src/app/core/models/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from './User.interface'; -export * from './Address.interface'; -export * from './Hotel.interface'; -export * from './Room.interface'; -export * from './Room.interface'; -export * from './Booking.interface'; -export * from './User.interface'; -export * from './Session.interface'; -export * from './Route.interface'; diff --git a/angular/RestClient/src/app/core/services/api/bookings/booking-client.service.ts b/angular/RestClient/src/app/core/services/api/bookings/booking-client.service.ts index ec7237002b22ad9edcc14cb608019b4c26dd0bb0..5f206025b7d53cb077a96880de8fe1e1477d9c11 100644 --- a/angular/RestClient/src/app/core/services/api/bookings/booking-client.service.ts +++ b/angular/RestClient/src/app/core/services/api/bookings/booking-client.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs'; import { environment } from '../../../../../environments/environment'; -import { Booking } from '../../../models/Booking.interface'; // Ajusta la ruta a tu modelo Booking +import { Booking } from '@features/bookings'; @Injectable({ providedIn: 'root', diff --git a/angular/RestClient/src/app/features/admin/admin.module.ts b/angular/RestClient/src/app/features/admin/admin.module.ts deleted file mode 100644 index f1b4844ad31582d72f6c9f50ad441483c3ea8bea..0000000000000000000000000000000000000000 --- a/angular/RestClient/src/app/features/admin/admin.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - - - -@NgModule({ - declarations: [], - imports: [ - CommonModule - ] -}) -export class AdminModule { } diff --git a/angular/RestClient/src/app/features/bookings/index.ts b/angular/RestClient/src/app/features/bookings/index.ts index 295ef468572fd100710157a4e23dd9efe537a2bc..c7386177ce9bde32b5f6c1a5f0d03858169c5430 100644 --- a/angular/RestClient/src/app/features/bookings/index.ts +++ b/angular/RestClient/src/app/features/bookings/index.ts @@ -2,3 +2,4 @@ export * from './bookings.routes'; export * from './booking/booking.component'; export * from './[DEL] booking-list/booking-list.component'; export * from './user-booking-list/user-booking-list.component'; +export * from './types/Booking'; diff --git a/angular/RestClient/src/app/features/bookings/types/Booking.d.ts b/angular/RestClient/src/app/features/bookings/types/Booking.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..daf5e92facf5f69c0f78ce8e17711ac16cfcd259 --- /dev/null +++ b/angular/RestClient/src/app/features/bookings/types/Booking.d.ts @@ -0,0 +1,9 @@ +export interface Booking { + id: number; + start: Date; + end: Date; + userId: number; + managerId: number; + hotelId: number; + roomId: number; +} diff --git a/angular/RestClient/src/app/features/hotels/index.ts b/angular/RestClient/src/app/features/hotels/index.ts index 3af2b5ac86e2a4b41ca3f1e5b79cc989999238b2..0084125c4d0f97bae64c166a9f2eb77e8e8f443f 100644 --- a/angular/RestClient/src/app/features/hotels/index.ts +++ b/angular/RestClient/src/app/features/hotels/index.ts @@ -1,3 +1,6 @@ export * from './hotels.routes'; export * from './hotel-list/hotel-list.component'; export * from './hotel-register/hotel-register.component'; +export * from './types/Address'; +export * from './types/Hotel'; +export * from './types/Room.interface'; diff --git a/angular/RestClient/src/app/core/models/Address.interface.ts b/angular/RestClient/src/app/features/hotels/types/Address.d.ts similarity index 100% rename from angular/RestClient/src/app/core/models/Address.interface.ts rename to angular/RestClient/src/app/features/hotels/types/Address.d.ts diff --git a/angular/RestClient/src/app/core/models/Hotel.interface.ts b/angular/RestClient/src/app/features/hotels/types/Hotel.d.ts similarity index 70% rename from angular/RestClient/src/app/core/models/Hotel.interface.ts rename to angular/RestClient/src/app/features/hotels/types/Hotel.d.ts index 38c70511fefaeb20d3ddde3baf3f469c42d7f79e..f2d68cc1352f404365cd4a20a76b541a71303454 100644 --- a/angular/RestClient/src/app/core/models/Hotel.interface.ts +++ b/angular/RestClient/src/app/features/hotels/types/Hotel.d.ts @@ -1,4 +1,4 @@ -import { Address } from './Address.interface'; +import { Address } from './Address'; import { Room } from './Room.interface'; export interface Hotel { @@ -6,4 +6,5 @@ export interface Hotel { name: string; address: Address; rooms: Room[]; + managerId: number; } diff --git a/angular/RestClient/src/app/features/hotels/types/Room.interface.ts b/angular/RestClient/src/app/features/hotels/types/Room.interface.ts new file mode 100644 index 0000000000000000000000000000000000000000..76186dd6683ba85cd70b2d6bdeeebab81a890bc9 --- /dev/null +++ b/angular/RestClient/src/app/features/hotels/types/Room.interface.ts @@ -0,0 +1,9 @@ +export const roomTypeArray = ['SINGLE', 'DOUBLE', 'SUITE'] as const; +export type RoomType = typeof roomTypeArray; + +export interface Room { + id: number; + roomNumber: String; + type: RoomType; + available: boolean; +} diff --git a/angular/RestClient/src/app/features/users/index.ts b/angular/RestClient/src/app/features/users/index.ts index baccb6244faa93ab6973fb42ef34ffd14eee9bc5..33740119241c378d0b815016737858d2d30c78d7 100644 --- a/angular/RestClient/src/app/features/users/index.ts +++ b/angular/RestClient/src/app/features/users/index.ts @@ -1,3 +1,5 @@ export * from './users.routes'; export * from './main-page/main-page.component'; export * from './user-form/user-form.component'; +export * from './types/User.interface'; +export * from './types/UserFormData'; diff --git a/angular/RestClient/src/app/features/users/types/User.interface.ts b/angular/RestClient/src/app/features/users/types/User.interface.ts new file mode 100644 index 0000000000000000000000000000000000000000..955e3235074035657af30cee51f3e1860b05744d --- /dev/null +++ b/angular/RestClient/src/app/features/users/types/User.interface.ts @@ -0,0 +1,30 @@ +import { Booking } from '@features/bookings'; +import { Hotel } from '@features/hotels'; + +export interface User { + id: number; + name: string; + email: String; + rol: UserRol; +} + +export const UserRolesArray = ['CLIENT', 'HOTEL_ADMIN', 'ADMIN'] as const; +export type UserRol = typeof UserRolesArray; + +export interface Client extends User { + status: ClientState; + bookings: Booking[]; +} + +export interface HotelAdmin extends User { + hotels: Hotel[]; +} + +export type UserStateFilter = 'All' | ClientState; + +export const ClientStateArray = [ + 'NO_BOOKINGS', + 'WITH_ACTIVE_BOOKINGS', + 'WITH_INACTIVE_BOOKINGS', +] as const; +export type ClientState = typeof ClientStateArray; diff --git a/angular/RestClient/src/app/features/users/types/UserFormData.d.ts b/angular/RestClient/src/app/features/users/types/UserFormData.d.ts index 2796c6000dbf309e50e0fa670a2995896a8be6e9..de92d172338c5dd0b5ff61c657e34d1c806a2812 100644 --- a/angular/RestClient/src/app/features/users/types/UserFormData.d.ts +++ b/angular/RestClient/src/app/features/users/types/UserFormData.d.ts @@ -7,6 +7,7 @@ export type UserFormMode = | 'VIEW' | 'EDIT' | 'OTHER'; + export type ModeType = { formMode: UserFormMode; admin?: boolean; diff --git a/angular/RestClient/src/environments/environment.development.ts b/angular/RestClient/src/environments/environment.development.ts deleted file mode 100644 index f274e5edf297c322280400000710ffbfd88f7711..0000000000000000000000000000000000000000 --- a/angular/RestClient/src/environments/environment.development.ts +++ /dev/null @@ -1 +0,0 @@ -export const environment = {}; diff --git a/angular/RestClient/src/environments/environment.monolith.ts b/angular/RestClient/src/environments/environment.monolith.ts deleted file mode 100644 index 1d6faf67844291cbf4eaa659357b2a85bead22ff..0000000000000000000000000000000000000000 --- a/angular/RestClient/src/environments/environment.monolith.ts +++ /dev/null @@ -1,9 +0,0 @@ -const monolith = 'localhost:8080'; // kong - -export const environment = { - production: false, - authAPI: `http://localhost:8101`, - userAPI: `http://${monolith}/users`, - hotelAPI: `http://${monolith}/hotels`, - bookingAPI: `http://${monolith}/bookings`, -}; diff --git a/angular/RestClient/src/mocks/users.ts b/angular/RestClient/src/mocks/users.ts deleted file mode 100644 index c21e6712745692d04764ac71105d66eed363c533..0000000000000000000000000000000000000000 --- a/angular/RestClient/src/mocks/users.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Client, User } from '../app/core/models'; - -export const users: Client[] = [ - { - id: 1, - name: 'John Doe', - email: 'jon@com', - rol: 'CLIENT', - status: 'NO_BOOKINGS', - }, - { - id: 2, - name: 'Angela Doe', - email: 'angle@com', - rol: 'CLIENT', - status: 'NO_BOOKINGS', - }, -]; diff --git a/angular/RestClient/tsconfig.json b/angular/RestClient/tsconfig.json index 2f5f1c7db6874459db03595ba7a9f58e3e2f1a3d..821557e7cb09e762a61b1ada9e8f2f46de4fed3f 100644 --- a/angular/RestClient/tsconfig.json +++ b/angular/RestClient/tsconfig.json @@ -25,7 +25,7 @@ "@core/*": ["app/core/*"], // Alias para el core "@shared": ["app/shared"], // Alias para shared "@shared/*": ["app/shared/*"], // Alias para shared - "@features/*": ["app/core/features/*"], // Alias para features + "@features/*": ["app/features/*"], // Alias para features "@utils/*": ["app/utils/*"], // Alias para utilidades "@pages/*": ["app/pages/*"] // Alias para pages }