added method userById for graphql
This commit is contained in:
parent
e286ad5c63
commit
3ea85cb669
@ -4,9 +4,12 @@ import jakarta.validation.constraints.NotNull;
|
||||
import org.springframework.graphql.data.method.annotation.Argument;
|
||||
import org.springframework.graphql.data.method.annotation.QueryMapping;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import ru.dragonestia.picker.api.repository.type.UserIdentifier;
|
||||
import ru.dragonestia.picker.controller.graphql.entity.EntityNode;
|
||||
import ru.dragonestia.picker.controller.graphql.entity.EntityRoom;
|
||||
import ru.dragonestia.picker.controller.graphql.entity.EntityUser;
|
||||
import ru.dragonestia.picker.controller.graphql.entity.type.DataProvider;
|
||||
import ru.dragonestia.picker.model.User;
|
||||
import ru.dragonestia.picker.service.NodeService;
|
||||
import ru.dragonestia.picker.service.RoomService;
|
||||
import ru.dragonestia.picker.service.UserService;
|
||||
@ -61,4 +64,9 @@ public class GraphqlController {
|
||||
.map(room -> new EntityRoom(room, dataProvider))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@QueryMapping
|
||||
EntityUser userById(@Argument String id) {
|
||||
return new EntityUser(new User(UserIdentifier.of(id)), dataProvider);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ type Query {
|
||||
nodeById(id: String!): Node
|
||||
allRooms(nodeId: String!): [Room]
|
||||
roomById(nodeId: String!, roomId: String!): Room
|
||||
userById(id: String!): User!
|
||||
}
|
||||
|
||||
type Node {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user