Skip to content

Commit

Permalink
feat(#171): support entity version in entity viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
lukashornych committed Oct 16, 2024
1 parent 65dfe33 commit 2147b69
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const rawDataType = computed<Scalar | ExtraEntityObjectType | undefined>(() => {
const propertyName = props.propertyDescriptor.key.name
switch (propertyName) {
case StaticEntityProperties.PrimaryKey: return Scalar.Integer
case StaticEntityProperties.Version: return Scalar.Integer
case StaticEntityProperties.Locales: return Scalar.LocaleArray
case StaticEntityProperties.PriceInnerRecordHandling: return Scalar.String
default: return undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
export enum StaticEntityProperties {
PrimaryKey = 'primaryKey',
Version = 'version',
ParentPrimaryKey = 'parentPrimaryKey',
Locales = 'locales',
PriceInnerRecordHandling = 'priceInnerRecordHandling'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ export class EntityViewerService {
undefined,
ImmutableList()
))
descriptors.push(new EntityPropertyDescriptor(
EntityPropertyType.Entity,
EntityPropertyKey.entity(StaticEntityProperties.Version),
'Version',
'Version',
undefined,
undefined,
ImmutableList()
))
if (entitySchema.withHierarchy.getOrElse(false)) {
descriptors.push(new EntityPropertyDescriptor(
EntityPropertyType.Entity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ export class EvitaQLQueryExecutor extends QueryExecutor {

flattenedProperties.push([
EntityPropertyKey.entity(StaticEntityProperties.PrimaryKey),
this.wrapRawValueIntoNativeValue(
Object(entity.primaryKey)
),
this.wrapRawValueIntoNativeValue(entity.primaryKey)
])
flattenedProperties.push([
EntityPropertyKey.entity(StaticEntityProperties.Version),
this.wrapRawValueIntoNativeValue(entity.version)
])
flattenedProperties.push(this.flattenParent(entity))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class GraphQLQueryExecutor extends QueryExecutor {
const flattenedProperties: (WritableEntityProperty | undefined)[] = []

flattenedProperties.push([EntityPropertyKey.entity(StaticEntityProperties.PrimaryKey), this.wrapRawValueIntoNativeValue(entity[StaticEntityProperties.PrimaryKey])])
flattenedProperties.push([EntityPropertyKey.entity(StaticEntityProperties.Version), this.wrapRawValueIntoNativeValue(entity[StaticEntityProperties.Version])])
flattenedProperties.push(this.flattenParent(dataPointer, entity))
flattenedProperties.push([EntityPropertyKey.entity(StaticEntityProperties.Locales), this.wrapRawValueIntoNativeValue(entity[StaticEntityProperties.Locales])])
flattenedProperties.push([EntityPropertyKey.entity(StaticEntityProperties.PriceInnerRecordHandling), this.wrapRawValueIntoNativeValue(entity[StaticEntityProperties.PriceInnerRecordHandling])])
Expand Down

0 comments on commit 2147b69

Please sign in to comment.