Skip to content

Commit

Permalink
graphql query
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsamson7 committed Oct 11, 2024
1 parent 7e9611c commit a509c63
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import org.sirius.dorm.ObjectManager
import org.sirius.dorm.model.ObjectDescriptor
import org.sirius.dorm.model.PropertyDescriptor
import org.sirius.dorm.`object`.DataObject
import org.sirius.dorm.transaction.Status
import java.util.*
import java.util.concurrent.ConcurrentHashMap

Expand Down Expand Up @@ -126,7 +125,7 @@ class JSONReader(private val objectDescriptor: ObjectDescriptor) {
else return { node, obj, deserializer, context ->
val target = property.asRelation().targetDescriptor!!

if ( property.asRelation().multiplicity.mutliValued) {
if ( property.asRelation().multiplicity.multiValued) {
// multivalued

val array = node.get(property.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class JSONWriter(private val objectDescriptor: ObjectDescriptor) {
}
}
else {
if ( property.asRelation().multiplicity.mutliValued) {
if ( property.asRelation().multiplicity.multiValued) {
return { serializer, jsonGenerator, obj, context ->
val value = obj.relation(property.index)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package org.sirius.dorm.model
*
* All rights reserved
*/
enum class Multiplicity(val optional: Boolean, val mutliValued: Boolean) {
enum class Multiplicity(val optional: Boolean, val multiValued: Boolean) {
ZERO_OR_ONE(true, false),
ONE(false, false),
MANY(false, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class RelationDescriptor<T:Any>(name: String, val target: String, val multi
// override

override fun createProperty(obj: DataObject, status: Status, entity: PropertyEntity?) : Property {
val relation = if ( multiplicity.mutliValued ) MultiValuedRelation(
val relation = if ( multiplicity.multiValued ) MultiValuedRelation(
this,
status,
obj,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ObjectMutator(val objectManager: ObjectManager) {
obj[key] = coerce(input[key]!!, property.asAttribute())

else {
if ( property.asRelation().multiplicity.mutliValued) {
if ( property.asRelation().multiplicity.multiValued) {
val array = input[key] as Collection<Map<String,Any>>

// recursion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ class QueryBuilder(val objectManager: ObjectManager) {
}
}
else {
if (!property.asRelation().multiplicity.mutliValued) {
//if (!property.asRelation().multiplicity.multiValued) {
return buildExpression(root.get(property.name) as AbstractFrom, filter.get(key) as Map<String, Any>)
}
else
throw Error("NYS")
//}
//else
// throw Error("NYS")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class SchemaBuilder(val objectManager: ObjectManager) {
.type(type4<GraphQLOutputType>(field.asAttribute().baseType(), false))
)
else {
if ( field.asRelation().multiplicity.mutliValued) {
if ( field.asRelation().multiplicity.multiValued) {
newObject.field(
GraphQLFieldDefinition.newFieldDefinition()
.name(field.name)
Expand Down Expand Up @@ -114,7 +114,7 @@ class SchemaBuilder(val objectManager: ObjectManager) {
.type(type4<GraphQLInputType>(field.asAttribute().baseType(), true))
)
else {
if ( field.asRelation().multiplicity.mutliValued) {
if ( field.asRelation().multiplicity.multiValued) {
inputObject.field(
GraphQLInputObjectField.newInputObjectField()
.name(field.name)
Expand Down Expand Up @@ -179,13 +179,13 @@ class SchemaBuilder(val objectManager: ObjectManager) {
)
}
else {
if ( !property.asRelation().multiplicity.mutliValued) {
//if ( !property.asRelation().multiplicity.multiValued) {
filterBuilder.field(
GraphQLInputObjectField.newInputObjectField()
.name(property.name)
.type(GraphQLTypeReference.typeRef("${property.asRelation().target}Filter"))
)
}
//}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
=== TODO

- admin servicefinalisieren

- sql sieht komisch aus
- parser + like
- projektion mit id geht nicht weil kein join!
Expand All @@ -11,13 +9,15 @@

=== LATER

- admin service CRUD
- kopieren nach service :-)
- angular :-) mit builder simple

=== NOW

=== DONE

- admin service finalisieren
- TODOs in MVR
- join children geht, father nicht :-)
- like
Expand Down

0 comments on commit a509c63

Please sign in to comment.