mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 11:06:49 +00:00
rebasefix: fixing errors introduced during rebase merging
This commit is contained in:
parent
b5282b4568
commit
3462363228
@ -4643,7 +4643,7 @@ trait APIMethods600 {
|
||||
),
|
||||
List(
|
||||
$BankNotFound,
|
||||
$UserNotLoggedIn,
|
||||
$AuthenticatedUserIsRequired,
|
||||
UserHasMissingRoles,
|
||||
UnknownError
|
||||
),
|
||||
@ -4789,7 +4789,7 @@ trait APIMethods600 {
|
||||
schema = net.liftweb.json.parse("""{"description": "User preferences", "required": ["theme"], "properties": {"theme": {"type": "string", "example": "dark"}, "language": {"type": "string", "example": "en"}}}""").asInstanceOf[net.liftweb.json.JsonAST.JObject]
|
||||
),
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$AuthenticatedUserIsRequired,
|
||||
UserHasMissingRoles,
|
||||
InvalidJsonFormat,
|
||||
UnknownError
|
||||
@ -4871,7 +4871,7 @@ trait APIMethods600 {
|
||||
),
|
||||
List(
|
||||
$BankNotFound,
|
||||
$UserNotLoggedIn,
|
||||
$AuthenticatedUserIsRequired,
|
||||
UserHasMissingRoles,
|
||||
InvalidJsonFormat,
|
||||
UnknownError
|
||||
@ -4940,7 +4940,7 @@ trait APIMethods600 {
|
||||
schema = net.liftweb.json.parse("""{"description": "User preferences updated", "required": ["theme"], "properties": {"theme": {"type": "string", "example": "dark"}, "language": {"type": "string", "example": "en"}, "notifications_enabled": {"type": "boolean", "example": "true"}}}""").asInstanceOf[net.liftweb.json.JsonAST.JObject]
|
||||
),
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$AuthenticatedUserIsRequired,
|
||||
UserHasMissingRoles,
|
||||
InvalidJsonFormat,
|
||||
UnknownError
|
||||
@ -5010,7 +5010,7 @@ trait APIMethods600 {
|
||||
),
|
||||
List(
|
||||
$BankNotFound,
|
||||
$UserNotLoggedIn,
|
||||
$AuthenticatedUserIsRequired,
|
||||
UserHasMissingRoles,
|
||||
InvalidJsonFormat,
|
||||
UnknownError
|
||||
@ -5079,7 +5079,7 @@ trait APIMethods600 {
|
||||
schema = net.liftweb.json.parse("""{"description": "User preferences updated", "required": ["theme"], "properties": {"theme": {"type": "string", "example": "dark"}, "language": {"type": "string", "example": "en"}, "notifications_enabled": {"type": "boolean", "example": "true"}}}""").asInstanceOf[net.liftweb.json.JsonAST.JObject]
|
||||
),
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$AuthenticatedUserIsRequired,
|
||||
InvalidJsonFormat,
|
||||
UnknownError
|
||||
),
|
||||
@ -6929,7 +6929,7 @@ trait APIMethods600 {
|
||||
)
|
||||
),
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$AuthenticatedUserIsRequired,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagManageDynamicEntity, apiTagApi)
|
||||
@ -6984,7 +6984,7 @@ trait APIMethods600 {
|
||||
)
|
||||
),
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$AuthenticatedUserIsRequired,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagDynamicEntity, apiTagPersonalDynamicEntity, apiTagApi)
|
||||
|
||||
@ -1428,48 +1428,7 @@ object JSONFactory600 extends CustomJsonFormats with MdcLoggable {
|
||||
user_id = entity.userId,
|
||||
bank_id = entity.bankId,
|
||||
has_personal_entity = entity.hasPersonalEntity,
|
||||
definition = schema,
|
||||
record_count = recordCount
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create v6.0.0 response for management GET endpoints (includes record_count)
|
||||
*/
|
||||
def createDynamicEntitiesWithCountJson(
|
||||
entitiesWithCounts: List[(code.dynamicEntity.DynamicEntityCommons, Long)]
|
||||
): DynamicEntitiesWithCountJsonV600 = {
|
||||
import net.liftweb.json.JsonAST._
|
||||
import net.liftweb.json.parse
|
||||
|
||||
DynamicEntitiesWithCountJsonV600(
|
||||
dynamic_entities = entitiesWithCounts.map { case (entity, recordCount) =>
|
||||
// metadataJson contains the full internal format: { "EntityName": { schema }, "hasPersonalEntity": true }
|
||||
// We need to extract just the schema part using the entity name as key
|
||||
val fullJson = parse(entity.metadataJson).asInstanceOf[JObject]
|
||||
val schemaOption = fullJson.obj.find(_.name == entity.entityName).map(_.value.asInstanceOf[JObject])
|
||||
|
||||
// Validate that the dynamic key matches entity_name
|
||||
val dynamicKeyName = fullJson.obj.find(_.name != "hasPersonalEntity").map(_.name)
|
||||
if (dynamicKeyName.exists(_ != entity.entityName)) {
|
||||
throw new IllegalStateException(
|
||||
s"Dynamic entity key mismatch: stored entityName='${entity.entityName}' but dynamic key='${dynamicKeyName.getOrElse("none")}'"
|
||||
)
|
||||
}
|
||||
|
||||
val schemaObj = schemaOption.getOrElse(
|
||||
throw new IllegalStateException(s"Could not extract schema for entity '${entity.entityName}' from metadataJson")
|
||||
)
|
||||
|
||||
DynamicEntityDefinitionWithCountJsonV600(
|
||||
dynamic_entity_id = entity.dynamicEntityId.getOrElse(""),
|
||||
entity_name = entity.entityName,
|
||||
user_id = entity.userId,
|
||||
bank_id = entity.bankId,
|
||||
has_personal_entity = entity.hasPersonalEntity,
|
||||
schema = schemaObj,
|
||||
schema = schema,
|
||||
record_count = recordCount
|
||||
)
|
||||
}
|
||||
|
||||
@ -175,8 +175,8 @@ class DynamicEntityTest extends V600ServerSetup {
|
||||
val response = makePostRequest(request, write(rightEntityV600))
|
||||
Then("We should get a 401")
|
||||
response.code should equal(401)
|
||||
And("error should be " + UserNotLoggedIn)
|
||||
response.body.extract[ErrorMessage].message should equal(UserNotLoggedIn)
|
||||
And("error should be " + AuthenticatedUserIsRequired)
|
||||
response.body.extract[ErrorMessage].message should equal(AuthenticatedUserIsRequired)
|
||||
}
|
||||
|
||||
scenario("Create System Dynamic Entity - without proper role", ApiEndpoint1, VersionOfApi) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user