Browse Source

Merge pull request #3386 from thesan/olympia-add-opening-title

Olympia add `WorkingGroupOpeningMetadata.title`
Lezek123 3 years ago
parent
commit
9541ad7c9a

+ 3 - 0
cli/src/schemas/WorkingGroups.ts

@@ -16,6 +16,9 @@ export const WorkingGroupOpeningInputSchema: JsonSchema<WorkingGroupOpeningInput
       type: 'integer',
       minimum: 1,
     },
+    title: {
+      type: 'string',
+    },
     shortDescription: {
       type: 'string',
     },

+ 1 - 0
metadata-protobuf/proto/WorkingGroups.proto

@@ -15,6 +15,7 @@ message OpeningMetadata {
     optional InputType type = 2; // Suggested type of the UI answer input
   }
   repeated ApplicationFormQuestion application_form_questions = 6; // List of questions that should be answered during application
+  optional string title = 7;
 }
 
 message UpcomingOpeningMetadata {

+ 7 - 1
query-node/mappings/src/common.ts

@@ -198,7 +198,13 @@ export function deserializeMetadata<T>(
   metadataBytes: Bytes
 ): DecodedMetadataObject<T> | null {
   try {
-    return metaToObject(metadataType, metadataType.decode(metadataBytes.toU8a(true)))
+    const message = metadataType.decode(metadataBytes.toU8a(true))
+    Object.keys(message).forEach((key) => {
+      if (key in message && typeof message[key] === 'string') {
+        message[key] = perpareString(message[key])
+      }
+    })
+    return metaToObject(metadataType, message)
   } catch (e) {
     invalidMetadata(`Cannot deserialize ${metadataType.name}! Provided bytes: (${metadataBytes.toHex()})`)
     return null

+ 2 - 0
query-node/mappings/src/workingGroups.ts

@@ -172,6 +172,7 @@ export async function createWorkingGroupOpeningMetadata(
     expectedEndingTimestamp,
     hiringLimit,
     shortDescription,
+    title,
   } = metadata
 
   const openingMetadata = new WorkingGroupOpeningMetadata({
@@ -179,6 +180,7 @@ export async function createWorkingGroupOpeningMetadata(
     updatedAt: eventTime,
     originallyValid,
     applicationDetails: applicationDetails || undefined,
+    title: title || undefined,
     description: description || undefined,
     shortDescription: shortDescription || undefined,
     hiringLimit: hiringLimit || undefined,

+ 3 - 0
query-node/schemas/workingGroups.graphql

@@ -157,6 +157,9 @@ type WorkingGroupOpeningMetadata @entity {
   "Whether the originally provided metadata was valid"
   originallyValid: Boolean!
 
+  "Opening title"
+  title: String
+
   "Opening short description"
   shortDescription: String