fix schema credential and csv examples

This commit is contained in:
Cayo Puigdefabregas 2023-11-21 10:00:59 +01:00
parent 821b6d3889
commit ed1f36c1a1
5 changed files with 18 additions and 8 deletions

View File

@ -1,2 +1,2 @@
name surnames email typeOfPerson membershipType organisation validFrom validUntil identityDocType identityNumber name surnames email typeOfPerson membershipType organisation affiliatedSince
Pepe Gómez user1@example.org individual Member Pangea 01-01-2023 Pepe Gómez user1@example.org individual Member Pangea 01-01-2023

1 name surnames email typeOfPerson membershipType organisation validFrom affiliatedSince validUntil identityDocType identityNumber
2 Pepe Gómez user1@example.org individual Member Pangea 01-01-2023 01-01-2023

View File

@ -75,8 +75,10 @@ class ImportForm(forms.Form):
if not data_pd: if not data_pd:
self.exception("This file is empty!") self.exception("This file is empty!")
properties = self.json_schema['properties']['credentialSubject']['properties']
head_row = {x: '' for x in properties.keys()}
for n in range(df.last_valid_index()+1): for n in range(df.last_valid_index()+1):
row = {} row = head_row.copy()
for k in data_pd.keys(): for k in data_pd.keys():
row[k] = data_pd[k][n] or '' row[k] = data_pd[k][n] or ''

View File

@ -20,6 +20,8 @@
"lang": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#lang", "lang": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#lang",
"surnames": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#surnames", "surnames": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#surnames",
"email": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#email", "email": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#email",
"affiliatedSince": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#affiliatedSince",
"affiliatedUntil": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#affiliatedUntil",
"issued": "https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation#issued", "issued": "https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation#issued",
"validFrom": "https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation#validFrom", "validFrom": "https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation#validFrom",
"validUntil": "https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation#validUntil" "validUntil": "https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation#validUntil"
@ -87,9 +89,11 @@
"organisation": "Pangea", "organisation": "Pangea",
"membershipType": "{{ membershipType }}", "membershipType": "{{ membershipType }}",
"membershipId": "{{ vc_id }}", "membershipId": "{{ vc_id }}",
"AffiliatedFrom": "{{ AffiliatedFrom }}", "affiliatedSince": "{{ affiliatedSince }}",
"AffiliatedUntil": "{{ AffiliatedUntil }}", "affiliatedUntil": "{{ affiliatedUntil }}",
"typeOfPerson": "{{ typeOfPerson }}", "typeOfPerson": "{{ typeOfPerson }}",
"identityDocType": "{{ identityDocType }}",
"identityNumber": "{{ identityNumber }}",
"name": "{{ first_name }}", "name": "{{ first_name }}",
"surnames": "{{ last_name }}", "surnames": "{{ last_name }}",
"email": "{{ email }}", "email": "{{ email }}",

View File

@ -44,7 +44,10 @@ class RequestCredentialForm(forms.Form):
did = did[0].did did = did[0].did
cred = cred[0] cred = cred[0]
cred.issue(did) try:
cred.issue(did)
except Exception:
return
if commit: if commit:
cred.save() cred.save()

View File

@ -14,11 +14,11 @@
"membershipType": { "membershipType": {
"type": "string" "type": "string"
}, },
"AffiliatedFrom": { "affiliatedSince": {
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"AffiliatedUntil": { "affiliatedUntil": {
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
@ -54,6 +54,7 @@
}, },
"required": [ "required": [
"organisation", "organisation",
"affiliatedSince",
"typeOfPerson", "typeOfPerson",
"name", "name",
"surnames", "surnames",