자유게시판 모델 수정
This commit is contained in:
parent
f1e7bc69f2
commit
634ea93108
8
pom.xml
8
pom.xml
|
@ -84,6 +84,14 @@
|
|||
<artifactId>spring-security-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.vladmihalcea/hibernate-types-52 -->
|
||||
<dependency>
|
||||
<groupId>com.vladmihalcea</groupId>
|
||||
<artifactId>hibernate-types-52</artifactId>
|
||||
<version>2.7.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -43,13 +43,13 @@ public class LeagueController {
|
|||
}
|
||||
|
||||
@PutMapping(value = "/league/{leagueId}")
|
||||
public ResponseEntity<?> updateLeague(@PathVariable Long leagueId, LeagueEntity leagueEntity) throws Exception {
|
||||
public ResponseEntity<?> modify(@PathVariable Long leagueId, LeagueEntity leagueEntity) throws Exception {
|
||||
LeagueEntity leagueEntity1 = this.leagueService.modify(leagueEntity);
|
||||
return ResponseEntity.ok(leagueEntity1);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/league/{leagueId}")
|
||||
public ResponseEntity<?> deleteLeague(@PathVariable Long leagueId) {
|
||||
public ResponseEntity<?> removeById(@PathVariable Long leagueId) {
|
||||
Long res = this.leagueService.removeById(leagueId);
|
||||
return ResponseEntity.ok(res);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package com.totopia.server.modules.game.entity;
|
||||
|
||||
import com.totopia.server.commons.data.entity.DateAuditEntity;
|
||||
import com.vladmihalcea.hibernate.type.json.JsonStringType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.annotations.TypeDef;
|
||||
import org.hibernate.annotations.TypeDefs;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Map;
|
||||
|
@ -17,6 +21,9 @@ import java.util.Map;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@TypeDefs({
|
||||
@TypeDef(name = "json", typeClass = JsonStringType.class)
|
||||
})
|
||||
public class SportsEventResultEntity extends DateAuditEntity {
|
||||
|
||||
@Id
|
||||
|
@ -42,7 +49,8 @@ public class SportsEventResultEntity extends DateAuditEntity {
|
|||
@Column(name = "away_final_score")
|
||||
private Short awayFinalScore;
|
||||
|
||||
@Column(name = "score_Info", columnDefinition = "json")
|
||||
@Type(type = "json")
|
||||
@Column(name = "score_info", columnDefinition = "json")
|
||||
private Map<String, Object> scoreInfo;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.totopia.server.modules.info.controller;
|
||||
|
||||
import com.totopia.server.commons.data.payload.ApiResponse;
|
||||
import com.totopia.server.modules.info.entity.FreeBoardEntity;
|
||||
import com.totopia.server.modules.info.service.FreeBoardService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
public class FreeBoardController {
|
||||
|
||||
@Autowired
|
||||
private FreeBoardService freeBoardService;
|
||||
|
||||
@PostMapping(value = "/free-board")
|
||||
@ResponseStatus(code = HttpStatus.CREATED)
|
||||
public ResponseEntity<?> save(@Valid @RequestBody FreeBoardEntity freeBoardEntity) throws Exception{
|
||||
this.freeBoardService.save(freeBoardEntity);
|
||||
return ResponseEntity.ok().body(new ApiResponse(true, "FreeBoard registered successfully"));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/free-board")
|
||||
public Page<FreeBoardEntity> all(
|
||||
@SortDefault.SortDefaults({
|
||||
@SortDefault(
|
||||
sort = "createdAt",
|
||||
direction = Sort.Direction.DESC) })
|
||||
Pageable pageable) {
|
||||
return this.freeBoardService.getAllByPageable(pageable);
|
||||
}
|
||||
//
|
||||
// @GetMapping(value = "/users/{userId}")
|
||||
// public UserEntity findByUserId(@PathVariable Long userId) {
|
||||
// return this.userService.getUserById(userId);
|
||||
// }
|
||||
@GetMapping(value = "/free-board/{boardId}")
|
||||
public FreeBoardEntity findById(
|
||||
@PathVariable Long boardId) {
|
||||
return this.freeBoardService.getBoardById(boardId);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/free-board/{boardId}")
|
||||
public ResponseEntity<?> modify(@PathVariable Long boardId, FreeBoardEntity freeBoardEntity) throws Exception {
|
||||
FreeBoardEntity board = this.freeBoardService.modify(freeBoardEntity);
|
||||
return ResponseEntity.ok(board);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/free-board/{boardId}")
|
||||
public ResponseEntity<?> removeById(@PathVariable Long boardId) {
|
||||
Long res = this.freeBoardService.removeById(boardId);
|
||||
return ResponseEntity.ok(res);
|
||||
}
|
||||
}
|
|
@ -36,4 +36,7 @@ public class FreeBoardEntity extends UserDateAuditEntity {
|
|||
@Column(name = "attach_id", nullable = true)
|
||||
private Long attachFile;
|
||||
|
||||
@Transient
|
||||
private Long owner;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.totopia.server.modules.info.repository;
|
||||
|
||||
import com.totopia.server.modules.info.entity.FreeBoardEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface FreeBoardRepository extends JpaRepository<FreeBoardEntity, Long> {
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.totopia.server.modules.info.service;
|
||||
|
||||
import com.totopia.server.modules.info.entity.FreeBoardEntity;
|
||||
import com.totopia.server.modules.info.repository.FreeBoardRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class FreeBoardService {
|
||||
|
||||
@Autowired
|
||||
private FreeBoardRepository freeBoardRepository;
|
||||
|
||||
public void save(FreeBoardEntity freeBoardEntity) throws Exception {
|
||||
freeBoardEntity.setCreatedBy(freeBoardEntity.getOwner());
|
||||
this.freeBoardRepository.save(freeBoardEntity);
|
||||
}
|
||||
|
||||
public Page<FreeBoardEntity> getAllByPageable(Pageable pageable) {
|
||||
return this.freeBoardRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
public FreeBoardEntity modify(FreeBoardEntity freeBoardEntity) {
|
||||
freeBoardEntity.setUpdatedBy(1L);
|
||||
freeBoardEntity.setUpdatedAt(new Date());
|
||||
return this.freeBoardRepository.save(freeBoardEntity);
|
||||
}
|
||||
|
||||
public Long removeById(Long boardId) {
|
||||
this.freeBoardRepository.deleteById(boardId);
|
||||
return boardId;
|
||||
}
|
||||
|
||||
public FreeBoardEntity getBoardById(Long boardId) {
|
||||
return this.freeBoardRepository.findById(boardId).orElseThrow(null);
|
||||
}
|
||||
}
|
|
@ -48,11 +48,11 @@ public class UserEntity extends DateAuditEntity {
|
|||
private Boolean block = false;
|
||||
|
||||
@Basic
|
||||
@Column(name = "ref_enable", nullable = false)
|
||||
@Column(name = "ref_enable", nullable = true)
|
||||
private Boolean refEnable = false;
|
||||
|
||||
@Basic
|
||||
@Column(name = "ref_id", nullable = false)
|
||||
@Column(name = "ref_id", nullable = true)
|
||||
private Long ref;
|
||||
|
||||
@Basic
|
||||
|
|
|
@ -32,7 +32,7 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
|
|||
// Page<UserEntity> findAllByIsAdminTrue(Pageable pageable) throws Exception;
|
||||
|
||||
// 패스워드 리셋이 트루인 유저 리스
|
||||
Page<UserEntity> findAllByRequireResetTrue(Pageable pageable) throws Exception;
|
||||
// Page<UserEntity> findAllByRequireResetTrue(Pageable pageable) throws Exception;
|
||||
|
||||
// // 어드민이 펄스이며, 활동중인 현재 회원 리스트
|
||||
// Page<UserEntity> findAllByIsAdminFalseAndActivationEquals(String activation,
|
||||
|
|
|
@ -86,9 +86,9 @@ public class UserRepositoryTest {
|
|||
public void findAllByIsAdminTrue() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findAllByRequireResetTrue() {
|
||||
}
|
||||
// @Test
|
||||
// public void findAllByRequireResetTrue() {
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void findAllByIsAdminFalseAndActivationEquals() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user