From 4a55c79e8171aeba83828f12c18c817aa3bf280e Mon Sep 17 00:00:00 2001
From: hugcubi <hugo.cubino@estudiantes.uva.es>
Date: Thu, 26 Dec 2024 22:40:24 +0100
Subject: [PATCH] =?UTF-8?q?Adaptaci=C3=B3n=20parcial=20a=20nuevos=20datos?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/app/core/models/Booking.interface.ts  | 10 -------
 .../src/app/core/models/Room.interface.ts     | 10 -------
 .../src/app/core/models/Route.interface.ts    |  2 +-
 .../src/app/core/models/Session.interface.ts  |  2 +-
 .../src/app/core/models/User.interface.ts     | 25 ----------------
 .../RestClient/src/app/core/models/index.ts   |  9 ------
 .../api/bookings/booking-client.service.ts    |  2 +-
 .../src/app/features/admin/admin.module.ts    | 12 --------
 .../src/app/features/bookings/index.ts        |  1 +
 .../app/features/bookings/types/Booking.d.ts  |  9 ++++++
 .../src/app/features/hotels/index.ts          |  3 ++
 .../hotels/types/Address.d.ts}                |  0
 .../hotels/types/Hotel.d.ts}                  |  3 +-
 .../features/hotels/types/Room.interface.ts   |  9 ++++++
 .../src/app/features/users/index.ts           |  2 ++
 .../features/users/types/User.interface.ts    | 30 +++++++++++++++++++
 .../features/users/types/UserFormData.d.ts    |  1 +
 .../environments/environment.development.ts   |  1 -
 .../src/environments/environment.monolith.ts  |  9 ------
 angular/RestClient/src/mocks/users.ts         | 18 -----------
 angular/RestClient/tsconfig.json              |  2 +-
 21 files changed, 61 insertions(+), 99 deletions(-)
 delete mode 100644 angular/RestClient/src/app/core/models/Booking.interface.ts
 delete mode 100644 angular/RestClient/src/app/core/models/Room.interface.ts
 delete mode 100644 angular/RestClient/src/app/core/models/User.interface.ts
 delete mode 100644 angular/RestClient/src/app/core/models/index.ts
 delete mode 100644 angular/RestClient/src/app/features/admin/admin.module.ts
 create mode 100644 angular/RestClient/src/app/features/bookings/types/Booking.d.ts
 rename angular/RestClient/src/app/{core/models/Address.interface.ts => features/hotels/types/Address.d.ts} (100%)
 rename angular/RestClient/src/app/{core/models/Hotel.interface.ts => features/hotels/types/Hotel.d.ts} (70%)
 create mode 100644 angular/RestClient/src/app/features/hotels/types/Room.interface.ts
 create mode 100644 angular/RestClient/src/app/features/users/types/User.interface.ts
 delete mode 100644 angular/RestClient/src/environments/environment.development.ts
 delete mode 100644 angular/RestClient/src/environments/environment.monolith.ts
 delete mode 100644 angular/RestClient/src/mocks/users.ts

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 e4b65d2..0000000
--- 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 a00b1e5..0000000
--- 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 ad601f7..69ba0f2 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 59c7781..8afb809 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 3854af0..0000000
--- 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 311b36b..0000000
--- 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 ec72370..5f20602 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 f1b4844..0000000
--- 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 295ef46..c738617 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 0000000..daf5e92
--- /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 3af2b5a..0084125 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 38c7051..f2d68cc 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 0000000..76186dd
--- /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 baccb62..3374011 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 0000000..955e323
--- /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 2796c60..de92d17 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 f274e5e..0000000
--- 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 1d6faf6..0000000
--- 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 c21e671..0000000
--- 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 2f5f1c7..821557e 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
     }
-- 
GitLab