This commit is contained in:
Jottyfan
2023-09-15 16:48:42 +02:00
parent b9981e3dc5
commit 80696b0c0b
12 changed files with 258 additions and 10 deletions

View File

@@ -0,0 +1,40 @@
package de.jottyfan.bico.modules.profile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import de.jottyfan.bico.modules.profile.model.ProfileBean;
/**
*
* @author jotty
*
*/
@Service
public class ProfileService {
@Autowired
private ProfileRepository repository;
/**
* get the theme of the user
*
* @param username the name of the user
* @return the theme of the user
*/
public String getTheme(String username) {
ProfileBean bean = repository.getProfile(username);
return bean == null ? "light" : bean.getTheme();
}
/**
* update the theme of the user
*
* @param username the name of the user
* @param theme the theme; may be light or dark
*/
public void updateTheme(String username, String theme) {
repository.upsertTheme(username, theme);
}
}