|
@@ -6,6 +6,7 @@ import inn.ocsf.bee.freigeld.core.model.PersonIdentityPrivateMember
|
|
|
import inn.ocsf.bee.freigeld.core.model.PersonMemberPosition
|
|
|
import inn.ocsf.bee.freigeld.core.model.data.PersonData
|
|
|
import inn.ocsf.bee.freigeld.core.service.WorldService
|
|
|
+import org.springframework.http.HttpStatus
|
|
|
import org.springframework.http.ResponseEntity
|
|
|
import org.springframework.web.bind.annotation.*
|
|
|
import java.util.*
|
|
@@ -42,6 +43,22 @@ class OrgController {
|
|
|
}).distinctBy { it.id }
|
|
|
return ResponseEntity.ok(ret)
|
|
|
}
|
|
|
+
|
|
|
+ @RequestMapping("api/old/private/{privateId}", method = [RequestMethod.GET])
|
|
|
+ fun old(@PathVariable("privateId") privateId: UUID, @RequestParam("memberId") memberId: UUID): ResponseEntity<PrivatePersonInfo> {
|
|
|
+ val org = world.getPerson(privateId)
|
|
|
+ return if (org != null) {
|
|
|
+ val accessors = world.getPersonIdentitySet(org) ?: setOf()
|
|
|
+ val ret = accessors.filter { it is PersonIdentityPrivateMember }.map { it as PersonIdentityPrivateMember }.filter { it.personId == memberId }.map { PrivatePersonInfo(it.personId, it.position) }.firstOrNull()
|
|
|
+ if (ret != null) {
|
|
|
+ ResponseEntity.ok(ret)
|
|
|
+ } else {
|
|
|
+ ResponseEntity(HttpStatus.FORBIDDEN)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ResponseEntity(HttpStatus.NOT_FOUND)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
data class PrivatePersonInfo(val id: UUID, val position: PersonMemberPosition)
|