Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add value objects to list routes - old and new (DEV-65) #1917

Merged
merged 35 commits into from Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8d5741d
refactor: fix filename
mpro7 Oct 7, 2021
cd2aef5
feat: add create list payload & value objects
mpro7 Oct 8, 2021
9d7e32b
feat: add update list payload & value objects + update routes & respo…
mpro7 Oct 13, 2021
faf93a9
test: update test data
mpro7 Oct 13, 2021
c909a8e
many things happened, mainly add ChangeNodeInfoPayloadADM
mpro7 Oct 14, 2021
b95f566
update NodeCreatePayloadADM class
mpro7 Oct 14, 2021
aa2672a
refactor list payloads
mpro7 Oct 14, 2021
18e2d92
WIP - fix tests
mpro7 Oct 14, 2021
1f6b136
fix tests
mpro7 Oct 14, 2021
327bb8a
separate root and child nodes creation
mpro7 Oct 15, 2021
812683f
WIP: fix tests
mpro7 Oct 18, 2021
d2745d1
bring back ListChildNodeInfoADM non-optional comments
mpro7 Oct 20, 2021
e1c3c66
fix tests
mpro7 Oct 20, 2021
0d0cbde
update tests
mpro7 Oct 20, 2021
e8645cc
Merge branch 'main' into wip/DEV-65
mpro7 Oct 20, 2021
2eab17f
refactor list value objects + add tests
mpro7 Oct 20, 2021
e32fe49
remove redundant fields from RootNodeCreatePayloadADM
mpro7 Oct 22, 2021
51347b7
refactor list naming + remove redundand request type
mpro7 Oct 22, 2021
3579003
fix test
mpro7 Oct 22, 2021
47a7513
add ProjectIRI value object
mpro7 Oct 22, 2021
3aad90a
add CustomID value object
mpro7 Oct 22, 2021
983f396
add ListIRI value object
mpro7 Oct 22, 2021
c8abba6
add RootNodeIRI value object
mpro7 Oct 22, 2021
40a0938
fix tests
mpro7 Oct 25, 2021
2b5b607
update value objects + add unit tests
mpro7 Oct 26, 2021
f46eed2
update value objects
mpro7 Oct 27, 2021
a1a66de
remove RootNodeIRI value object
mpro7 Oct 27, 2021
2f12998
add more checks to value objects + update tests
mpro7 Oct 27, 2021
833a6d9
remove redundand tests
mpro7 Oct 27, 2021
9f9bc9c
fix optional comments creating child node
mpro7 Oct 27, 2021
5f30f4a
Merge branch 'main' into wip/DEV-65
mpro7 Oct 28, 2021
7aaffcf
clenup
mpro7 Oct 28, 2021
6df00c4
Merge branch 'main' into wip/DEV-65
mpro7 Oct 29, 2021
c1ea8f1
review fixes
mpro7 Oct 29, 2021
34c555c
minor improvements
mpro7 Oct 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,68 @@
package org.knora.webapi.messages.admin.responder.listsmessages

import org.knora.webapi.messages.admin.responder.valueObjects.{
Comments,
Labels,
ListIRI,
ListName,
Position,
ProjectIRI
}

/**
* List (parent node, former root node) and Node (former child node) creation payloads
*/
sealed trait NodeCreatePayloadADM
object NodeCreatePayloadADM {
final case class ListCreatePayloadADM(
id: Option[ListIRI] = None,
projectIri: ProjectIRI,
name: Option[ListName] = None,
labels: Labels,
comments: Comments
) extends NodeCreatePayloadADM
final case class ChildNodeCreatePayloadADM(
id: Option[ListIRI] = None,
parentNodeIri: Option[ListIRI] = None,
projectIri: ProjectIRI,
name: Option[ListName] = None,
position: Option[Position] = None,
labels: Labels,
comments: Option[Comments] = None
) extends NodeCreatePayloadADM
}

/**
* Node Info update payload
*/
final case class NodeInfoChangePayloadADM(
listIri: ListIRI,
projectIri: ProjectIRI,
hasRootNode: Option[ListIRI] = None,
position: Option[Position] = None,
name: Option[ListName] = None,
labels: Option[Labels] = None,
comments: Option[Comments] = None
)

/**
* Node Name update payload
*/
final case class NodeNameChangePayloadADM(
name: ListName
)

/**
* Node Labels update payload
*/
final case class NodeLabelsChangePayloadADM(
labels: Labels
)

/**
* Node Comments update payload
*/
final case class NodeCommentsChangePayloadADM(
// TODO: remove Option here
comments: Option[Comments] = None
)
Expand Up @@ -5,14 +5,19 @@

package org.knora.webapi.messages.admin.responder.listsmessages

object ListsMessagesUtilADM {
object ListsErrorMessagesADM {
val LIST_IRI_MISSING_ERROR = "List IRI cannot be empty."
val LIST_IRI_INVALID_ERROR = "List IRI cannot be empty."
val LIST_NODE_IRI_MISSING_ERROR = "List node IRI cannot be empty."
val LIST_NODE_IRI_INVALID_ERROR = "List node IRI is invalid."
val PROJECT_IRI_MISSING_ERROR = "Project IRI cannot be empty."
val PROJECT_IRI_INVALID_ERROR = "Project IRI is invalid."
val LIST_NAME_MISSING_ERROR = "List name cannot be empty."
val LIST_NAME_INVALID_ERROR = "List name is invalid."
val LABEL_MISSING_ERROR = "At least one label needs to be supplied."
val LABEL_INVALID_ERROR = "Invalid label."
val COMMENT_MISSING_ERROR = "At least one comment needs to be supplied."
val COMMENT_INVALID_ERROR = "Invalid comment."
val LIST_CREATE_PERMISSION_ERROR = "A list can only be created by the project or system administrator."
val LIST_NODE_CREATE_PERMISSION_ERROR = "A list node can only be created by the project or system administrator."
val LIST_CHANGE_PERMISSION_ERROR = "A list can only be changed by the project or system administrator."
Expand Down