Changeset f0d5cb7 for src/main/java/it


Ignore:
Timestamp:
09/03/21 11:25:12 (3 years ago)
Author:
KostaFortumanov <kfortumanov@…>
Branches:
master
Children:
f8007b3
Parents:
5577566
Message:

Added moderator class

Location:
src/main/java/it/finki/charitable
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/charitable/controller/DonationPostController.java

    r5577566 rf0d5cb7  
    11package it.finki.charitable.controller;
    22
    3 import it.finki.charitable.entities.AppUser;
    4 import it.finki.charitable.entities.DonationInformation;
    5 import it.finki.charitable.entities.DonationPost;
    6 import it.finki.charitable.entities.FundsCollected;
     3import it.finki.charitable.entities.*;
    74import it.finki.charitable.services.DonationInformationService;
    85import it.finki.charitable.services.DonationPostService;
     
    183180        DonationInformation donationInformation = new DonationInformation(amount, post.getId(), post.getTitle());
    184181        donationInformationService.save(donationInformation);
    185         AppUser user = userService.loadUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName());
     182        MainUser user = (MainUser) userService.loadUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName());
    186183        user.getDonationInformation().add(donationInformation);
    187184        userService.saveUser(user);
  • src/main/java/it/finki/charitable/controller/HomeController.java

    r5577566 rf0d5cb7  
    22
    33import it.finki.charitable.entities.AppUser;
     4import it.finki.charitable.entities.MainUser;
     5import it.finki.charitable.entities.Moderator;
    46import it.finki.charitable.entities.UserRole;
    57import it.finki.charitable.security.ConfirmationToken;
     
    8991        }
    9092
    91         AppUser user = new AppUser();
     93        AppUser user = new MainUser();
    9294        user.setFirstName(firstName);
    9395        user.setLastName(lastName);
  • src/main/java/it/finki/charitable/controller/UserProfileController.java

    r5577566 rf0d5cb7  
    44import it.finki.charitable.entities.DonationInformation;
    55import it.finki.charitable.entities.DonationPost;
     6import it.finki.charitable.entities.MainUser;
    67import it.finki.charitable.security.PasswordEncoder;
    78import it.finki.charitable.services.DonationPostService;
     
    3738    public String myDonations(Model model) {
    3839        model.addAttribute("myDonations", true);
    39         AppUser user = userService.loadUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName());
     40        MainUser user = (MainUser) userService.loadUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName());
    4041        List<DonationInformation> donations = user.getDonationInformation();
    4142        model.addAttribute("donations", donations);
     
    8990        }
    9091
    91         AppUser user = (AppUser) model.getAttribute("user");
     92        MainUser user = (MainUser) model.getAttribute("user");
    9293        user.setCreditCardInfo(cardName + "," + cardNumber + "," + expiryDate + "," + cvv);
    9394        userService.saveUser(user);
     
    9899    @RequestMapping("/removeCardInfo")
    99100    public String removeCardInfo(Model model) {
    100         AppUser user = (AppUser) model.getAttribute("user");
     101        MainUser user = (MainUser) model.getAttribute("user");
    101102        user.setCreditCardInfo(null);
    102103        userService.saveUser(user);
  • src/main/java/it/finki/charitable/entities/AppUser.java

    r5577566 rf0d5cb7  
    3636    private String email;
    3737    private String password;
    38     private String creditCardInfo;
    3938    @Enumerated(EnumType.STRING)
    4039    private UserRole userRole;
    4140    private Boolean enabled;
    42 
    43     @OneToMany
    44     private List<DonationInformation> donationInformation = new ArrayList<>();
    4541
    4642    public AppUser() {
     
    8379    }
    8480
    85     public String getCreditCardInfo() {
    86         return creditCardInfo;
    87     }
    88 
    89     public void setCreditCardInfo(String creditCardInfo) {
    90         this.creditCardInfo = creditCardInfo;
    91     }
    92 
    9381    public UserRole getUserRole() {
    9482        return userRole;
     
    10593    public void setEnabled(Boolean enabled) {
    10694        this.enabled = enabled;
    107     }
    108 
    109     public List<DonationInformation> getDonationInformation() {
    110         return donationInformation;
    111     }
    112 
    113     public void setDonationInformation(List<DonationInformation> donationInformation) {
    114         this.donationInformation = donationInformation;
    11595    }
    11696
Note: See TracChangeset for help on using the changeset viewer.