|
|
@ -0,0 +1,26 @@ |
|
|
|
package com.iflytop.digester.underframework.controller; |
|
|
|
import com.iflytop.digester.underframework.dao.model.UfMdbNotification; |
|
|
|
import com.iflytop.digester.underframework.dao.record.UfActiveRecord; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import java.util.Map; |
|
|
|
@Controller |
|
|
|
public class UfApiNotification extends UfApiControllerBase { |
|
|
|
@ResponseBody |
|
|
|
@PostMapping("/api/notification/fetch-one") |
|
|
|
public UfApiResponse notificationFetchOne() { |
|
|
|
var notification = UfActiveRecord.findOne(UfMdbNotification.class, Map.of("status", "new")); |
|
|
|
return this.success(notification); |
|
|
|
} |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
@PostMapping("/api/notification/mark-read") |
|
|
|
public UfApiResponse notificationMarkRead(@RequestBody UfMdbNotification notification) { |
|
|
|
notification.reload(); |
|
|
|
notification.status = "read"; |
|
|
|
notification.save(); |
|
|
|
return this.success(); |
|
|
|
} |
|
|
|
} |