diff --git a/angular/RestClient/src/app/app.routes.ts b/angular/RestClient/src/app/app.routes.ts index dc45a08aa11a13a097f916862e2154cc28aec616..435147aaba7cab6a92b72a93c0bf217eded0540d 100644 --- a/angular/RestClient/src/app/app.routes.ts +++ b/angular/RestClient/src/app/app.routes.ts @@ -5,41 +5,120 @@ import { HotelRegisterComponent } from './core/features/hotel/hotel-register/hot import { MainPageComponent } from './core/features/user/main-page/main-page.component'; import { BookingListComponent } from './core/features/bookings/booking-list/booking-list.component'; import { UserBookingListComponent } from './core/features/user/user-booking-list/user-booking-list.component'; + import { LoginComponent } from './core/features/auth/login/login.component'; +import { UserFormComponent } from './core/features/user/user-form/user-form.component'; export const routes: Routes = [ { path: '', // Ruta principal - component: MainPageComponent, // Componente de la página principal + component: MainPageComponent, }, + // auth { - path: 'bookings/search', - component: BookingListComponent, + path: 'login', + component: LoginComponent, }, { - path: 'bookings/new', - component: BookingComponent, + path: 'register', }, + // Hoteles { - path: 'users/:id/bookings', - component: UserBookingListComponent, + path: 'hotels', // Ruta para la lista de hoteles }, { - path: 'hotels', - component: HotelListComponent, + path: 'hotels/register', // Registrar nuevo hotel }, { - path: 'hotels/new', - component: HotelRegisterComponent, + path: 'hotels/:id', // Hotel concreto }, { - path: 'hotels/:id', - component: HotelRegisterComponent, + path: 'hotels/:id/edit', // Modificar hotel + }, + // Usuario + { + path: 'me', // Main + }, + { + path: 'me/edit', // Main + }, + // Usuario HOTEL admin + { + path: 'me/hotels', + }, + { + path: 'me/hotels/:id', }, { path: 'auth/login', - component: LoginComponent, }, + { + path: 'me/hotels/:id/bookings', + }, + { + path: 'me/hotels/:id/rooms', + }, + { + path: 'me/hotels/:id/rooms/:id', + }, + { + path: 'me/hotels/:id/rooms/:id/bookings', + }, + // Usuario Cliente + { + path: 'me/bookings', + }, + { + path: 'me/bookings/:id', + }, + { + path: 'me/bookings/new', + }, + // Administrador + { + path: 'admin', // Main + }, + { + path: 'admin/users', // Main + }, + { + path: 'admin/users/:id', // Main + }, + + // ! OTRO // NO MIRAR + + // { + // path: 'bookings/search', + // component: BookingListComponent, + // }, + // { + // path: 'bookings/new', + // component: BookingComponent, + // }, + // { + // path: 'users/:id/bookings', + // component: UserBookingListComponent, + // }, + // { + // path: 'hotels', + // component: HotelListComponent, + // }, + // { + // path: 'hotels/new', + // component: HotelRegisterComponent, + // }, + // { + // path: 'hotels/:id', + // component: HotelRegisterComponent, + // }, + // { + // path: 'users/:id', + // component: UserFormComponent, + // }, + // { + // path: 'register', + // component: UserFormComponent, + // }, { path: '**', redirectTo: '', diff --git a/java/services/auth/src/main/java/com/uva/authentication/models/remote/User.java b/java/services/auth/src/main/java/com/uva/authentication/models/remote/User.java new file mode 100644 index 0000000000000000000000000000000000000000..a72ecfa8ef8f896afda01b7b1ead124c09b81fab --- /dev/null +++ b/java/services/auth/src/main/java/com/uva/authentication/models/remote/User.java @@ -0,0 +1,95 @@ +package com.uva.authentication.models.remote; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import jakarta.persistence.Basic; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; + +@Entity +@Inheritance(strategy = InheritanceType.JOINED) +@Table(name = "users") +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic(optional = false) + @Column(nullable = false) + private int id; + + @Basic(optional = false) + @Column(nullable = false) + private String name; + + @Basic(optional = false) + @Column(nullable = false, unique = true) + private String email; + + @JsonIgnore + @Basic(optional = false) + @Column(nullable = false) + private String password; + + @Basic(optional = false) + @Column(nullable = false) + @Enumerated(EnumType.STRING) + private UserRol rol = UserRol.CLIENT; + + public User() { + } + + public User(int id, String name, String email, String password, UserRol rol) { + setId(id); + setName(name); + setEmail(email); + setRol(rol); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return this.email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String rawPassword) { + this.password = rawPassword; + } + + public UserRol getRol() { + return this.rol; + } + + public void setRol(UserRol rol) { + this.rol = rol; + } +}