Add Admin accounts
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
package de.htwsaar.webshop.controller;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static de.htwsaar.webshop.config.ControllerPathConfig.HARDCODE_IMAGE_DPS_STICKER;
|
||||
import static de.htwsaar.webshop.util.LoggerUtil.logRequest;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class ImageHardcodeController {
|
||||
private final ResourceLoader resourceLoader;
|
||||
|
||||
@Autowired
|
||||
public ImageHardcodeController(ResourceLoader resourceLoader) {
|
||||
this.resourceLoader = resourceLoader;
|
||||
}
|
||||
|
||||
@RequestMapping(value = HARDCODE_IMAGE_DPS_STICKER, method = RequestMethod.GET)
|
||||
Resource dpsSticker(HttpServletRequest request) {
|
||||
logRequest(request);
|
||||
return resourceLoader.getResource("classpath:images/dps_sticker.webp");
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.type.NumericBooleanConverter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -29,4 +30,9 @@ public class Account {
|
||||
|
||||
@Column(name = "lang_i18n", nullable = false)
|
||||
private String langI18n;
|
||||
|
||||
|
||||
@Convert(converter = NumericBooleanConverter.class)
|
||||
@Column(name = "admin", nullable = false)
|
||||
private Boolean admin;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ CREATE TABLE IF NOT EXISTS Accounts
|
||||
email TEXT NOT NULL,
|
||||
password TEXT NOT NULL,
|
||||
lang_i18n TEXT NOT NULL,
|
||||
admin INTEGER NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY (customer_id) REFERENCES Customers (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
|
||||
Reference in New Issue
Block a user