Ignore:
Timestamp:
02/09/23 16:05:47 (23 months ago)
Author:
milamihajlovska <mila.mihajlovska01@…>
Branches:
master
Children:
01a1ca6
Parents:
17a2fda
Message:

update register and registerWorker

Location:
src/main/java/com/example/moviezone/service
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/service/CinemaService.java

    r17a2fda r5444409  
    77public interface CinemaService {
    88    List<Cinema> findAllCinemas();
     9    Cinema findCinemaById(Integer id_cinema);
    910}
  • src/main/java/com/example/moviezone/service/Impl/CinemaServiceImpl.java

    r17a2fda r5444409  
    2020        return cinemaRepository.findAll();
    2121    }
     22
     23    @Override
     24    public Cinema findCinemaById(Integer id_cinema) {
     25        return cinemaRepository.findById(id_cinema).orElseThrow(RuntimeException::new);
     26    }
    2227}
  • src/main/java/com/example/moviezone/service/Impl/UserServiceImpl.java

    r17a2fda r5444409  
    11package com.example.moviezone.service.Impl;
    22
    3 import com.example.moviezone.model.Customer;
    4 import com.example.moviezone.model.Role;
    5 import com.example.moviezone.model.User;
    6 import com.example.moviezone.model.Worker;
     3import com.example.moviezone.model.*;
    74import com.example.moviezone.model.exceptions.InvalidUsernameOrPasswordException;
    85import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException;
     
    7572    }
    7673
     74    @Override
     75    public void registerWorker(String first_name, String last_name, String username, String email, String number, String password, String position, String work_hours_from, String work_hours_to, Cinema cinema) {
     76        userRepository.save(new Worker(password,first_name,last_name,email,number,username,position,work_hours_from,work_hours_to,cinema));
     77
     78    }
     79
    7780
    7881}
  • src/main/java/com/example/moviezone/service/UserService.java

    r17a2fda r5444409  
    11package com.example.moviezone.service;
    22
     3import com.example.moviezone.model.Cinema;
    34import com.example.moviezone.model.Role;
    45import com.example.moviezone.model.User;
     
    1314    void register(String first_name, String last_name,String username, String email, String number, String password, Role role);
    1415    User login(String username,String password);
     16    void registerWorker(String first_name, String last_name, String username, String email, String number, String password, String position, String work_hours_from, String work_hours_to, Cinema cinema);
    1517}
Note: See TracChangeset for help on using the changeset viewer.