diff --git a/v2/data_model.json b/v2/data_model.json index df3a636..cff7714 100644 --- a/v2/data_model.json +++ b/v2/data_model.json @@ -2,7 +2,7 @@ "GUID": "6b45e040-7fae-11ea-ba73-c97a35e85484", "modelName": "FightPandemics", "code": "FightPandemics", - "lastModifTS": "2020-05-01T16:51:25.713Z", + "lastModifTS": "2020-08-24T20:11:43.006Z", "persistenceSchemaVersion": "4", "description": "", "comments": "", @@ -1507,7 +1507,8 @@ "comments": "", "id": "individual", "additionalProperties": true, - "error": {} + "error": {}, + "displayName": "subschema" }, { "GUID": "a43c95d0-82ef-11ea-821a-a1813ece7f73", @@ -1976,7 +1977,8 @@ "comments": "", "id": "organization", "additionalProperties": false, - "error": {} + "error": {}, + "displayName": "subschema" } ], "choice": "oneOf", @@ -2025,7 +2027,8 @@ "id": "emailPK", "additionalProperties": true, "hackoladeMeta": {}, - "error": {} + "error": {}, + "displayName": "subschema" }, { "GUID": "6d920e70-8bc8-11ea-8bf8-cf9318f71002", @@ -2064,11 +2067,60 @@ "comments": "", "id": "phonePK", "additionalProperties": false, - "error": {} + "error": {}, + "displayName": "subschema" } ], "choice": "anyOf", "GUID": "54fd06d0-8bc8-11ea-8bf8-cf9318f71002" + }, + { + "type": "timestamp", + "primaryKey": false, + "relationshipType": "", + "parentRelationship": "", + "childRelationships": [], + "foreignCollection": "", + "foreignField": [], + "default": "", + "format": "", + "sample": "", + "GUID": "a04ee0f0-e644-11ea-a4f2-f91e5514bec6", + "name": "acceptedPrivacyAt", + "code": "", + "description": "", + "comments": "", + "dependencies": [], + "required": true, + "id": "", + "hackoladeMeta": {}, + "error": { + "name": false + } + }, + { + "type": "timestamp", + "primaryKey": false, + "relationshipType": "", + "parentRelationship": "", + "childRelationships": [], + "foreignCollection": "", + "foreignField": [], + "default": "", + "format": "", + "sample": "", + "GUID": "ab588050-e644-11ea-a4f2-f91e5514bec6", + "name": "acceptedTermsAt", + "code": "", + "description": "", + "comments": "", + "dependencies": [], + "required": true, + "id": "", + "hackoladeMeta": {}, + "error": { + "name": false + } } ], "definitions": { @@ -2476,14 +2528,18 @@ "relationshipType": "Foreign Key", "parentCollection": "96933f00-7fb2-11ea-ba73-c97a35e85484", "parentField": [ - "96933f00-7fb2-11ea-ba73-c97a35e85484", - "ae4f24b0-7fb2-11ea-ba73-c97a35e85484" + [ + "96933f00-7fb2-11ea-ba73-c97a35e85484", + "ae4f24b0-7fb2-11ea-ba73-c97a35e85484" + ] ], "parentCardinality": "1", "childCollection": "bd34fec0-7fb0-11ea-ba73-c97a35e85484", "childField": [ - "bd34fec0-7fb0-11ea-ba73-c97a35e85484", - "bd359b02-7fb0-11ea-ba73-c97a35e85484" + [ + "bd34fec0-7fb0-11ea-ba73-c97a35e85484", + "bd359b02-7fb0-11ea-ba73-c97a35e85484" + ] ], "childCardinality": "n" }, @@ -2495,15 +2551,19 @@ "relationshipType": "Foreign Key", "parentCollection": "efec04b0-7fb2-11ea-ba73-c97a35e85484", "parentField": [ - "efec04b0-7fb2-11ea-ba73-c97a35e85484", - "fa469f60-7fb2-11ea-ba73-c97a35e85484" + [ + "efec04b0-7fb2-11ea-ba73-c97a35e85484", + "fa469f60-7fb2-11ea-ba73-c97a35e85484" + ] ], "parentCardinality": "n", "childCollection": "bd34fec0-7fb0-11ea-ba73-c97a35e85484", "childField": [ - "bd34fec0-7fb0-11ea-ba73-c97a35e85484", - "deadb930-8108-11ea-a764-5d61b98a5ce8", - "deb75620-8108-11ea-a764-5d61b98a5ce8" + [ + "bd34fec0-7fb0-11ea-ba73-c97a35e85484", + "deadb930-8108-11ea-a764-5d61b98a5ce8", + "deb75620-8108-11ea-a764-5d61b98a5ce8" + ] ], "childCardinality": "n" }, @@ -2515,15 +2575,19 @@ "relationshipType": "Foreign Key", "parentCollection": "efec04b0-7fb2-11ea-ba73-c97a35e85484", "parentField": [ - "efec04b0-7fb2-11ea-ba73-c97a35e85484", - "fa469f60-7fb2-11ea-ba73-c97a35e85484" + [ + "efec04b0-7fb2-11ea-ba73-c97a35e85484", + "fa469f60-7fb2-11ea-ba73-c97a35e85484" + ] ], "parentCardinality": "n", "childCollection": "96933f00-7fb2-11ea-ba73-c97a35e85484", "childField": [ - "96933f00-7fb2-11ea-ba73-c97a35e85484", - "04d0c120-8109-11ea-a764-5d61b98a5ce8", - "04dad340-8109-11ea-a764-5d61b98a5ce8" + [ + "96933f00-7fb2-11ea-ba73-c97a35e85484", + "04d0c120-8109-11ea-a764-5d61b98a5ce8", + "04dad340-8109-11ea-a764-5d61b98a5ce8" + ] ], "childCardinality": "n" }, @@ -2535,16 +2599,20 @@ "relationshipType": "Foreign Key", "parentCollection": null, "parentField": [ - "efec04b0-7fb2-11ea-ba73-c97a35e85484", - "fa469f60-7fb2-11ea-ba73-c97a35e85484" + [ + "efec04b0-7fb2-11ea-ba73-c97a35e85484", + "fa469f60-7fb2-11ea-ba73-c97a35e85484" + ] ], "parentCardinality": "1", "childCollection": "68a89cd0-8132-11ea-a764-5d61b98a5ce8", "childField": [ - "68a89cd0-8132-11ea-a764-5d61b98a5ce8", - "f6ed4180-82ef-11ea-821a-a1813ece7f73", - "bf6dcc20-82ef-11ea-821a-a1813ece7f73", - "b4066f90-8132-11ea-a764-5d61b98a5ce8" + [ + "68a89cd0-8132-11ea-a764-5d61b98a5ce8", + "f6ed4180-82ef-11ea-821a-a1813ece7f73", + "bf6dcc20-82ef-11ea-821a-a1813ece7f73", + "b4066f90-8132-11ea-a764-5d61b98a5ce8" + ] ], "childCardinality": "n", "lineSize": 2 @@ -2557,16 +2625,20 @@ "relationshipType": "Foreign Key", "parentCollection": "efec04b0-7fb2-11ea-ba73-c97a35e85484", "parentField": [ - "efec04b0-7fb2-11ea-ba73-c97a35e85484", - "fa469f60-7fb2-11ea-ba73-c97a35e85484" + [ + "efec04b0-7fb2-11ea-ba73-c97a35e85484", + "fa469f60-7fb2-11ea-ba73-c97a35e85484" + ] ], "parentCardinality": "1", "childCollection": "96933f00-7fb2-11ea-ba73-c97a35e85484", "childField": [ - "96933f00-7fb2-11ea-ba73-c97a35e85484", - "db65c2f0-82f1-11ea-821a-a1813ece7f73", - "ce5f8570-811e-11ea-a764-5d61b98a5ce8", - "96938d21-7fb2-11ea-ba73-c97a35e85484" + [ + "96933f00-7fb2-11ea-ba73-c97a35e85484", + "db65c2f0-82f1-11ea-821a-a1813ece7f73", + "ce5f8570-811e-11ea-a764-5d61b98a5ce8", + "96938d21-7fb2-11ea-ba73-c97a35e85484" + ] ], "childCardinality": "n", "lineSize": 2 @@ -2579,14 +2651,18 @@ "relationshipType": "Foreign Key", "parentCollection": "efec04b0-7fb2-11ea-ba73-c97a35e85484", "parentField": [ - "efec04b0-7fb2-11ea-ba73-c97a35e85484", - "fa469f60-7fb2-11ea-ba73-c97a35e85484" + [ + "efec04b0-7fb2-11ea-ba73-c97a35e85484", + "fa469f60-7fb2-11ea-ba73-c97a35e85484" + ] ], "parentCardinality": "1", "childCollection": "bd34fec0-7fb0-11ea-ba73-c97a35e85484", "childField": [ - "bd34fec0-7fb0-11ea-ba73-c97a35e85484", - "deadb930-8108-11ea-a764-5d61b98a5ce8" + [ + "bd34fec0-7fb0-11ea-ba73-c97a35e85484", + "deadb930-8108-11ea-a764-5d61b98a5ce8" + ] ], "childCardinality": "1" }, @@ -2598,14 +2674,18 @@ "relationshipType": "Foreign Key", "parentCollection": "bd34fec0-7fb0-11ea-ba73-c97a35e85484", "parentField": [ - "bd34fec0-7fb0-11ea-ba73-c97a35e85484", - "e5c2c520-7fb0-11ea-ba73-c97a35e85484" + [ + "bd34fec0-7fb0-11ea-ba73-c97a35e85484", + "e5c2c520-7fb0-11ea-ba73-c97a35e85484" + ] ], "parentCardinality": "1", "childCollection": "bd34fec0-7fb0-11ea-ba73-c97a35e85484", "childField": [ - "bd34fec0-7fb0-11ea-ba73-c97a35e85484", - "bd359b01-7fb0-11ea-ba73-c97a35e85484" + [ + "bd34fec0-7fb0-11ea-ba73-c97a35e85484", + "bd359b01-7fb0-11ea-ba73-c97a35e85484" + ] ], "childCardinality": "1" }, @@ -2617,14 +2697,18 @@ "relationshipType": "Foreign Key", "parentCollection": "efec04b0-7fb2-11ea-ba73-c97a35e85484", "parentField": [ - "efec04b0-7fb2-11ea-ba73-c97a35e85484", - "fa469f60-7fb2-11ea-ba73-c97a35e85484" + [ + "efec04b0-7fb2-11ea-ba73-c97a35e85484", + "fa469f60-7fb2-11ea-ba73-c97a35e85484" + ] ], "parentCardinality": "1", "childCollection": "05136460-84b7-11ea-8f4d-0b62bb8cf8ca", "childField": [ - "05136460-84b7-11ea-8f4d-0b62bb8cf8ca", - "ade31210-84b8-11ea-8f4d-0b62bb8cf8ca" + [ + "05136460-84b7-11ea-8f4d-0b62bb8cf8ca", + "ade31210-84b8-11ea-8f4d-0b62bb8cf8ca" + ] ], "childCardinality": "1" } @@ -2727,7 +2811,9 @@ "720aec60-8bc8-11ea-8bf8-cf9318f71002": "phone", "96938d21-7fb2-11ea-ba73-c97a35e85484": "id", "a5ed67f0-811f-11ea-a764-5d61b98a5ce8": "name", - "eb7fe190-811e-11ea-a764-5d61b98a5ce8": "type" + "eb7fe190-811e-11ea-a764-5d61b98a5ce8": "type", + "a04ee0f0-e644-11ea-a4f2-f91e5514bec6": "acceptedPrivacyAt", + "ab588050-e644-11ea-a4f2-f91e5514bec6": "acceptedTermsAt" }, "definitions": { "type": "definitions", @@ -3145,7 +3231,7 @@ "pluginEngineVersion": "1.0.0" }, "applicationInformation": { - "version": "4.0.1" + "version": "4.1.14" }, "settings": { "centralPane": { @@ -3273,45 +3359,10 @@ } ], "buckets": [ - { - "x": 48, - "y": 70, - "GUID": "6d3c5910-7fae-11ea-ba73-c97a35e85484" - }, - { - "x": 137, - "y": 436, - "GUID": "d93b54d0-7faf-11ea-ba73-c97a35e85484" - }, { "x": 40, "y": 92.6666666666666, "GUID": "bd396b90-7fb0-11ea-ba73-c97a35e85484" - }, - { - "x": 40, - "y": 376, - "GUID": "d3377f30-7fb1-11ea-ba73-c97a35e85484" - }, - { - "x": 40, - "y": 496, - "GUID": "e9a11b50-7fb1-11ea-ba73-c97a35e85484" - }, - { - "x": 40, - "y": 432, - "GUID": "fee45fe0-7fb1-11ea-ba73-c97a35e85484" - }, - { - "x": 494.15295834780045, - "y": 189.51640454543502, - "GUID": "969cb4e0-7fb2-11ea-ba73-c97a35e85484" - }, - { - "x": 40, - "y": 1099.0671634753458, - "GUID": "efee9cc0-7fb2-11ea-ba73-c97a35e85484" } ], "collapsedNodes": [ diff --git a/v2/scripts/JSON_Document/applicationDB/users.json b/v2/scripts/JSON_Document/applicationDB/users.json index 96384f5..8008da7 100644 --- a/v2/scripts/JSON_Document/applicationDB/users.json +++ b/v2/scripts/JSON_Document/applicationDB/users.json @@ -1,39 +1,41 @@ -{ - "createdAt": ISODate("2016-04-08T15:06:21.595Z"), - "_id": ObjectId("507f1f77bcf86cd799439011"), - "updatedAt": ISODate("2016-04-08T15:06:21.595Z"), - "authId": "Lorem", - "location": { - "coordinates": [ - 35.26, - -32.83 - ], - "type": "Point", - "country": "Lorem", - "city": "Lorem", - "neighborhood": "Lorem", - "address": "Lorem" - }, - "about": "Lorem", - "photo": "./resource.txt#frag01", - "type": "other", - "industry": "Lorem", - "ownerId": ObjectId("507f1f77bcf86cd799439011"), - "name": "Lorem", - "needs": { - "volunteers": true, - "donations": false, - "staff": false, - "other": false - }, - "global": false, - "urls": { - "linkedin": "http://linkedin.com/in/myProfile", - "twitter": "http://twitter.com/myProfile", - "website": "http://mypersonalwebsite.com", - "playstore": "http://playstore.com/myOrg", - "appstore": "http://appstore.com/myOrg" - }, - "language": "Lorem", - "email": "test_user@fightpandemics.com" +{ + "createdAt": ISODate("2016-04-08T15:06:21.595Z"), + "_id": ObjectId("507f1f77bcf86cd799439011"), + "updatedAt": ISODate("2016-04-08T15:06:21.595Z"), + "authId": "Lorem", + "location": { + "coordinates": [ + 35.26, + -32.83 + ], + "type": "Point", + "country": "Lorem", + "city": "Lorem", + "neighborhood": "Lorem", + "address": "Lorem" + }, + "about": "Lorem", + "photo": "./resource.txt#frag01", + "type": "other", + "industry": "Lorem", + "ownerId": ObjectId("507f1f77bcf86cd799439011"), + "name": "Lorem", + "needs": { + "volunteers": true, + "donations": false, + "staff": false, + "other": false + }, + "global": false, + "urls": { + "linkedin": "http://linkedin.com/in/myProfile", + "twitter": "http://twitter.com/myProfile", + "website": "http://mypersonalwebsite.com", + "playstore": "http://playstore.com/myOrg", + "appstore": "http://appstore.com/myOrg" + }, + "language": "Lorem", + "email": "test_user@fightpandemics.com", + "acceptedPrivacyAt": Timestamp(1460127718,1), + "acceptedTermsAt": Timestamp(1460127718,1) } \ No newline at end of file diff --git a/v2/scripts/JSON_Schema/applicationDB/users.json b/v2/scripts/JSON_Schema/applicationDB/users.json index 6ae6f75..4c8edb9 100644 --- a/v2/scripts/JSON_Schema/applicationDB/users.json +++ b/v2/scripts/JSON_Schema/applicationDB/users.json @@ -1,361 +1,314 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "title": "users", - "description": "Collection that holds all the data on system's users. \n\nThe users can be of **two types**: **(1) Individual**, representing a private user account; and **(2) Organization**, representing an organization of various types.\n\nThe field 'type' is used to differentiate between the two subschemas, with 'individual' representing private user accounts and \"Community\", \"Government\", \"Health care provider\", \"Non-profit\", \"Other\", \"R&D\", \"Startup\", \"Traditional Company\" and \"University\".", - "additionalProperties": true, - "properties": { - "createdAt": { - "type": "string", - "description": "Timestamp with the user's creation date", - "format": "date-time" - }, - "_id": { - "type": "string", - "description": "Automatically generated _it as primary key.", - "pattern": "^[a-fA-F0-9]{24}$" - }, - "updatedAt": { - "type": "string", - "description": "Timestamp indicating last update on the database.", - "format": "date-time" - }, - "authId": { - "type": "string", - "description": "String holding the authentication service id (Auth0).\n\nThis field is a **foreign key to the user in the Auth0 database**, connecting through the user_id field." - }, - "location": { - "type": "object", - "properties": { - "coordinates": { - "type": "array", - "additionalItems": true, - "minItems": 2, - "maxItems": 2, - "uniqueItems": false, - "description": "Array with the coordinates, specifying **longitude first** and **latitude second**, as default in the [GeoJSON](https://docs.mongodb.com/manual/reference/geojson/) definition.", - "items": [ - { - "type": "number", - "minimum": -180, - "maximum": 180, - "default": 0, - "description": "Location longitude\n", - "id": "lng" - }, - { - "type": "number", - "minimum": -90, - "maximum": 90, - "default": 0, - "description": "Location latitude\n", - "id": "lat" - } - ] - }, - "type": { - "type": "string", - "enum": [ - "Point" - ], - "description": "Type of the GeoJSON Object.\nPlease refer to the [official documentation](https://docs.mongodb.com/manual/reference/geojson/ ) for more information.\n\n**In our case, the value will always be of the type \"Point\".**" - }, - "country": { - "type": "string", - "description": "String holding the country's name.\n" - }, - "city": { - "type": "string", - "description": "String holding the city's name." - }, - "neighborhood": { - "type": "string", - "description": "String holding the neighborhood's name." - }, - "address": { - "type": "string", - "description": "String holding the address (street, number and other details)." - } - }, - "additionalProperties": false, - "description": "Location document according to the norms of a [GeoJSON Object](https://docs.mongodb.com/manual/reference/geojson/ ).\nThe fields address, neighborhood, city, state and country are added to store the result of the geoprocessing.", - "required": [ - "coordinates", - "type" - ] - }, - "about": { - "type": "string", - "description": "Small self-introduction, limited to 100 char" - }, - "photo": { - "type": "string", - "description": "URI with the location of the profile's photo.", - "format": "uri" - } - }, - "oneOf": [ - { - "id": "individual", - "type": "object", - "description": "Subschema representing a individual account.", - "properties": { - "type": { - "type": "string", - "enum": [ - "individual" - ] - }, - "firstName": { - "type": "string", - "description": "The first name of the user" - }, - "lastName": { - "type": "string", - "description": "The last name of the user. Optional field." - }, - "needs": { - "type": "object", - "description": "User's need in the app, representing what kind of help he/she needs", - "properties": { - "medicalHelp": { - "type": "boolean", - "description": "Flag to indicate wheter the user needs medical help. \nMarking this indicates he shows symptoms of COVID-19.", - "default": false - }, - "otherHelp": { - "type": "boolean", - "description": "Flag to indicate wheter the user needs non-medical help, such as getting groceries, medice and etc..", - "default": false - } - }, - "additionalProperties": false, - "required": [ - "medicalHelp", - "otherHelp" - ] - }, - "objectives": { - "type": "object", - "description": "Document with what are the objectives of the user through the application, such as donating, volunteering or sharing information.", - "properties": { - "volunteer": { - "type": "boolean", - "description": "Flag to indicate wheter the user wants to volunteer for iniciatives through the app.", - "default": false - }, - "donate": { - "type": "boolean", - "description": "Flag to indicate wheter the user wants to donate for iniciatives through the app.", - "default": false - }, - "shareInformation": { - "type": "boolean", - "description": "Flag to indicate wheter the user wants to share information through the app.", - "default": true - } - }, - "additionalProperties": false, - "required": [ - "volunteer", - "donate", - "shareInformation" - ] - }, - "urls": { - "type": "object", - "description": "Document holding the user urls to external websites and social networks", - "properties": { - "facebook": { - "type": "string", - "description": "URL to user's Facebook page.", - "format": "uri" - }, - "linkedin": { - "type": "string", - "description": "URL to user's Linkedin page.", - "format": "uri" - }, - "twitter": { - "type": "string", - "description": "URL to user's Twitter page.", - "format": "uri" - }, - "github": { - "type": "string", - "description": "URL to user's Github page.", - "format": "uri" - }, - "website": { - "type": "string", - "description": "URL to user's personal website.", - "format": "uri" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": true, - "required": [ - "type", - "firstName", - "needs" - ] - }, - { - "id": "organization", - "type": "object", - "description": "Subschema representing an organization (colective) account.", - "properties": { - "type": { - "type": "string", - "description": "The type of the organization. Can be: Community, Government, Health care provider, Non-profit, Other, R&D, Startup, Traditional Company and University. All names are store in lowercase only.", - "enum": [ - "startup", - "traditional company", - "community", - "government", - "r&d", - "non-profit", - "university", - "health care provider", - "other" - ] - }, - "industry": { - "type": "string", - "description": "Industry from which the organization participates. Plan is for this values to be scraped from linkedin industries." - }, - "ownerId": { - "type": "string", - "description": "_id of the user who owns the organization.", - "pattern": "^[a-fA-F0-9]{24}$" - }, - "name": { - "type": "string", - "description": "Organization's name.\n" - }, - "needs": { - "type": "object", - "description": "Document with what are the objectives of the organization through the application, such as finding volunteers, staff, investors and donors.", - "properties": { - "volunteers": { - "type": "boolean", - "description": "Flag to indicate wheter the organization is seeking volunteers through the app.", - "default": false - }, - "donations": { - "type": "boolean", - "description": "Flag to indicate wheter the organization is seeking donations through the app.", - "default": false - }, - "staff": { - "type": "boolean", - "description": "Flag to indicate wheter the organization is seeking staff through the app.", - "default": false - }, - "other": { - "type": "boolean", - "description": "Flag to indicate wheter the organization is seeking other needs through the app.", - "default": false - } - }, - "additionalProperties": false, - "required": [ - "volunteers", - "donations", - "staff", - "other" - ] - }, - "global": { - "type": "boolean", - "description": "Flag to indicate wheter this organization is global.", - "default": false - }, - "urls": { - "type": "object", - "description": "Document holding external urls and refs to the organization such as social media profiles.", - "properties": { - "linkedin": { - "type": "string", - "description": "URL to organization's Linkedin page.", - "format": "uri" - }, - "twitter": { - "type": "string", - "description": "URL to organization's Twitter page.", - "format": "uri" - }, - "website": { - "type": "string", - "description": "URL to organization's website.", - "format": "uri" - }, - "playstore": { - "type": "string", - "description": "URL to organization's page at Google Play Store.", - "format": "uri" - }, - "appstore": { - "type": "string", - "description": "URL to organization's page at Apple App Store", - "format": "uri" - } - }, - "additionalProperties": false - }, - "language": { - "type": "string", - "description": "Field to inidicate the language used by the organization." - } - }, - "additionalProperties": false, - "required": [ - "type", - "industry", - "ownerId", - "name", - "needs" - ] - } - ], - "anyOf": [ - { - "id": "emailPK", - "type": "object", - "description": "Case where the user comes from social networks with a registration that uses email. In this case, the email field is required. This case covers the great majority of currently supported social network authentications.", - "properties": { - "email": { - "type": "string", - "description": "User's email validated by a regex pattern.", - "format": "email" - } - }, - "additionalProperties": true, - "required": [ - "email" - ] - }, - { - "id": "phonePK", - "type": "object", - "description": "Case where the user comes from social networks with a registration that allows the use of only the phone. In this case, the phone field is required, and the email isn't. \n\nAn example of ocial network that falls into this case is Twitter.", - "properties": { - "phone": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "phone" - ] - } - ], - "required": [ - "createdAt", - "_id", - "updatedAt", - "authId" - ] +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "title": "users", + "description": "Collection that holds all the data on system's users. \n\nThe users can be of **two types**: **(1) Individual**, representing a private user account; and **(2) Organization**, representing an organization of various types.\n\nThe field 'type' is used to differentiate between the two subschemas, with 'individual' representing private user accounts and \"Community\", \"Government\", \"Health care provider\", \"Non-profit\", \"Other\", \"R&D\", \"Startup\", \"Traditional Company\" and \"University\".", + "additionalProperties": true, + "properties": { + "createdAt": { + "type": "string", + "description": "Timestamp with the user's creation date", + "format": "date-time" + }, + "_id": { + "type": "string", + "description": "Automatically generated _it as primary key.", + "pattern": "^[a-fA-F0-9]{24}$" + }, + "updatedAt": { + "type": "string", + "description": "Timestamp indicating last update on the database.", + "format": "date-time" + }, + "authId": { + "type": "string", + "description": "String holding the authentication service id (Auth0).\n\nThis field is a **foreign key to the user in the Auth0 database**, connecting through the user_id field." + }, + "location": { + "$ref": "#model/definitions/location" + }, + "about": { + "type": "string", + "description": "Small self-introduction, limited to 100 char" + }, + "photo": { + "type": "string", + "description": "URI with the location of the profile's photo.", + "format": "uri" + }, + "acceptedPrivacyAt": { + "type": "string", + "format": "date-time" + }, + "acceptedTermsAt": { + "type": "string", + "format": "date-time" + } + }, + "oneOf": [ + { + "id": "individual", + "type": "object", + "description": "Subschema representing a individual account.", + "properties": { + "type": { + "type": "string", + "enum": [ + "individual" + ] + }, + "firstName": { + "type": "string", + "description": "The first name of the user" + }, + "lastName": { + "type": "string", + "description": "The last name of the user. Optional field." + }, + "needs": { + "type": "object", + "description": "User's need in the app, representing what kind of help he/she needs", + "properties": { + "medicalHelp": { + "type": "boolean", + "description": "Flag to indicate wheter the user needs medical help. \nMarking this indicates he shows symptoms of COVID-19.", + "default": false + }, + "otherHelp": { + "type": "boolean", + "description": "Flag to indicate wheter the user needs non-medical help, such as getting groceries, medice and etc..", + "default": false + } + }, + "additionalProperties": false, + "required": [ + "medicalHelp", + "otherHelp" + ] + }, + "objectives": { + "type": "object", + "description": "Document with what are the objectives of the user through the application, such as donating, volunteering or sharing information.", + "properties": { + "volunteer": { + "type": "boolean", + "description": "Flag to indicate wheter the user wants to volunteer for iniciatives through the app.", + "default": false + }, + "donate": { + "type": "boolean", + "description": "Flag to indicate wheter the user wants to donate for iniciatives through the app.", + "default": false + }, + "shareInformation": { + "type": "boolean", + "description": "Flag to indicate wheter the user wants to share information through the app.", + "default": true + } + }, + "additionalProperties": false, + "required": [ + "volunteer", + "donate", + "shareInformation" + ] + }, + "urls": { + "type": "object", + "description": "Document holding the user urls to external websites and social networks", + "properties": { + "facebook": { + "type": "string", + "description": "URL to user's Facebook page.", + "format": "uri" + }, + "linkedin": { + "type": "string", + "description": "URL to user's Linkedin page.", + "format": "uri" + }, + "twitter": { + "type": "string", + "description": "URL to user's Twitter page.", + "format": "uri" + }, + "github": { + "type": "string", + "description": "URL to user's Github page.", + "format": "uri" + }, + "website": { + "type": "string", + "description": "URL to user's personal website.", + "format": "uri" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": true, + "required": [ + "type", + "firstName", + "needs" + ] + }, + { + "id": "organization", + "type": "object", + "description": "Subschema representing an organization (colective) account.", + "properties": { + "type": { + "type": "string", + "description": "The type of the organization. Can be: Community, Government, Health care provider, Non-profit, Other, R&D, Startup, Traditional Company and University. All names are store in lowercase only.", + "enum": [ + "startup", + "traditional company", + "community", + "government", + "r&d", + "non-profit", + "university", + "health care provider", + "other" + ] + }, + "industry": { + "type": "string", + "description": "Industry from which the organization participates. Plan is for this values to be scraped from linkedin industries." + }, + "ownerId": { + "type": "string", + "description": "_id of the user who owns the organization.", + "pattern": "^[a-fA-F0-9]{24}$" + }, + "name": { + "type": "string", + "description": "Organization's name.\n" + }, + "needs": { + "type": "object", + "description": "Document with what are the objectives of the organization through the application, such as finding volunteers, staff, investors and donors.", + "properties": { + "volunteers": { + "type": "boolean", + "description": "Flag to indicate wheter the organization is seeking volunteers through the app.", + "default": false + }, + "donations": { + "type": "boolean", + "description": "Flag to indicate wheter the organization is seeking donations through the app.", + "default": false + }, + "staff": { + "type": "boolean", + "description": "Flag to indicate wheter the organization is seeking staff through the app.", + "default": false + }, + "other": { + "type": "boolean", + "description": "Flag to indicate wheter the organization is seeking other needs through the app.", + "default": false + } + }, + "additionalProperties": false, + "required": [ + "volunteers", + "donations", + "staff", + "other" + ] + }, + "global": { + "type": "boolean", + "description": "Flag to indicate wheter this organization is global.", + "default": false + }, + "urls": { + "type": "object", + "description": "Document holding external urls and refs to the organization such as social media profiles.", + "properties": { + "linkedin": { + "type": "string", + "description": "URL to organization's Linkedin page.", + "format": "uri" + }, + "twitter": { + "type": "string", + "description": "URL to organization's Twitter page.", + "format": "uri" + }, + "website": { + "type": "string", + "description": "URL to organization's website.", + "format": "uri" + }, + "playstore": { + "type": "string", + "description": "URL to organization's page at Google Play Store.", + "format": "uri" + }, + "appstore": { + "type": "string", + "description": "URL to organization's page at Apple App Store", + "format": "uri" + } + }, + "additionalProperties": false + }, + "language": { + "type": "string", + "description": "Field to inidicate the language used by the organization." + } + }, + "additionalProperties": false, + "required": [ + "type", + "industry", + "ownerId", + "name", + "needs" + ] + } + ], + "anyOf": [ + { + "id": "emailPK", + "type": "object", + "description": "Case where the user comes from social networks with a registration that uses email. In this case, the email field is required. This case covers the great majority of currently supported social network authentications.", + "properties": { + "email": { + "type": "string", + "description": "User's email validated by a regex pattern.", + "format": "email" + } + }, + "additionalProperties": true, + "required": [ + "email" + ] + }, + { + "id": "phonePK", + "type": "object", + "description": "Case where the user comes from social networks with a registration that allows the use of only the phone. In this case, the phone field is required, and the email isn't. \n\nAn example of ocial network that falls into this case is Twitter.", + "properties": { + "phone": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "phone" + ] + } + ], + "required": [ + "createdAt", + "_id", + "updatedAt", + "authId", + "acceptedPrivacyAt", + "acceptedTermsAt" + ] } \ No newline at end of file diff --git a/v2/scripts/MongoDB_Script/applicationDB/users.js b/v2/scripts/MongoDB_Script/applicationDB/users.js index 5edc53c..2c319f4 100644 --- a/v2/scripts/MongoDB_Script/applicationDB/users.js +++ b/v2/scripts/MongoDB_Script/applicationDB/users.js @@ -1,338 +1,343 @@ -use applicationDB; - -db.createCollection( "users",{ - "storageEngine": { - "wiredTiger": {} - }, - "capped": false, - "validator": { - "$jsonSchema": { - "bsonType": "object", - "title": "users", - "description": "Collection that holds all the data on system's users. \n\nThe users can be of **two types**: **(1) Individual**, representing a private user account; and **(2) Organization**, representing an organization of various types.\n\nThe field 'type' is used to differentiate between the two subschemas, with 'individual' representing private user accounts and \"Community\", \"Government\", \"Health care provider\", \"Non-profit\", \"Other\", \"R&D\", \"Startup\", \"Traditional Company\" and \"University\".", - "additionalProperties": true, - "properties": { - "_id": { - "bsonType": "objectId", - "description": "Automatically generated _it as primary key." - }, - "createdAt": { - "bsonType": "date", - "description": "Timestamp with the user's creation date" - }, - "updatedAt": { - "bsonType": "date", - "description": "Timestamp indicating last update on the database." - }, - "authId": { - "bsonType": "string", - "description": "String holding the authentication service id (Auth0).\n\nThis field is a **foreign key to the user in the Auth0 database**, connecting through the user_id field." - }, - "location": { - "bsonType": "object", - "description": "Location document according to the norms of a [GeoJSON Object](https://docs.mongodb.com/manual/reference/geojson/ ).\nThe fields address, neighborhood, city, state and country are added to store the result of the geoprocessing.", - "properties": { - "coordinates": { - "bsonType": "array", - "description": "Array with the coordinates, specifying **longitude first** and **latitude second**, as default in the [GeoJSON](https://docs.mongodb.com/manual/reference/geojson/) definition.", - "additionalItems": true, - "minItems": 2, - "maxItems": 2, - "uniqueItems": false, - "items": [ - { - "bsonType": "number", - "description": "Location longitude\n", - "minimum": -180, - "maximum": 180 - }, - { - "bsonType": "number", - "description": "Location latitude\n", - "minimum": -90, - "maximum": 90 - } - ] - }, - "type": { - "bsonType": "string", - "description": "Type of the GeoJSON Object.\nPlease refer to the [official documentation](https://docs.mongodb.com/manual/reference/geojson/ ) for more information.\n\n**In our case, the value will always be of the type \"Point\".**", - "enum": [ - "Point" - ] - }, - "country": { - "bsonType": "string", - "description": "String holding the country's name.\n" - }, - "city": { - "bsonType": "string", - "description": "String holding the city's name." - }, - "neighborhood": { - "bsonType": "string", - "description": "String holding the neighborhood's name." - }, - "address": { - "bsonType": "string", - "description": "String holding the address (street, number and other details)." - } - }, - "additionalProperties": false, - "required": [ - "coordinates", - "type" - ] - }, - "about": { - "bsonType": "string", - "description": "Small self-introduction, limited to 100 char" - }, - "photo": { - "bsonType": "string", - "description": "URI with the location of the profile's photo." - } - }, - "oneOf": [ - { - "bsonType": "object", - "description": "Subschema representing a individual account.", - "properties": { - "type": { - "bsonType": "string", - "enum": [ - "individual" - ] - }, - "firstName": { - "bsonType": "string", - "description": "The first name of the user" - }, - "lastName": { - "bsonType": "string", - "description": "The last name of the user. Optional field." - }, - "needs": { - "bsonType": "object", - "description": "User's need in the app, representing what kind of help he/she needs", - "properties": { - "medicalHelp": { - "bsonType": "bool", - "description": "Flag to indicate wheter the user needs medical help. \nMarking this indicates he shows symptoms of COVID-19." - }, - "otherHelp": { - "bsonType": "bool", - "description": "Flag to indicate wheter the user needs non-medical help, such as getting groceries, medice and etc.." - } - }, - "additionalProperties": false, - "required": [ - "medicalHelp", - "otherHelp" - ] - }, - "objectives": { - "bsonType": "object", - "description": "Document with what are the objectives of the user through the application, such as donating, volunteering or sharing information.", - "properties": { - "volunteer": { - "bsonType": "bool", - "description": "Flag to indicate wheter the user wants to volunteer for iniciatives through the app." - }, - "donate": { - "bsonType": "bool", - "description": "Flag to indicate wheter the user wants to donate for iniciatives through the app." - }, - "shareInformation": { - "bsonType": "bool", - "description": "Flag to indicate wheter the user wants to share information through the app." - } - }, - "additionalProperties": false, - "required": [ - "volunteer", - "donate", - "shareInformation" - ] - }, - "urls": { - "bsonType": "object", - "description": "Document holding the user urls to external websites and social networks", - "properties": { - "facebook": { - "bsonType": "string", - "description": "URL to user's Facebook page." - }, - "linkedin": { - "bsonType": "string", - "description": "URL to user's Linkedin page." - }, - "twitter": { - "bsonType": "string", - "description": "URL to user's Twitter page." - }, - "github": { - "bsonType": "string", - "description": "URL to user's Github page." - }, - "website": { - "bsonType": "string", - "description": "URL to user's personal website." - } - }, - "additionalProperties": false - } - }, - "additionalProperties": true, - "required": [ - "type", - "firstName", - "needs" - ] - }, - { - "bsonType": "object", - "description": "Subschema representing an organization (colective) account.", - "properties": { - "type": { - "bsonType": "string", - "description": "The type of the organization. Can be: Community, Government, Health care provider, Non-profit, Other, R&D, Startup, Traditional Company and University. All names are store in lowercase only.", - "enum": [ - "startup", - "traditional company", - "community", - "government", - "r&d", - "non-profit", - "university", - "health care provider", - "other" - ] - }, - "industry": { - "bsonType": "string", - "description": "Industry from which the organization participates. Plan is for this values to be scraped from linkedin industries." - }, - "ownerId": { - "bsonType": "objectId", - "description": "_id of the user who owns the organization." - }, - "name": { - "bsonType": "string", - "description": "Organization's name.\n" - }, - "needs": { - "bsonType": "object", - "description": "Document with what are the objectives of the organization through the application, such as finding volunteers, staff, investors and donors.", - "properties": { - "volunteers": { - "bsonType": "bool", - "description": "Flag to indicate wheter the organization is seeking volunteers through the app." - }, - "donations": { - "bsonType": "bool", - "description": "Flag to indicate wheter the organization is seeking donations through the app." - }, - "staff": { - "bsonType": "bool", - "description": "Flag to indicate wheter the organization is seeking staff through the app." - }, - "other": { - "bsonType": "bool", - "description": "Flag to indicate wheter the organization is seeking other needs through the app." - } - }, - "additionalProperties": false, - "required": [ - "volunteers", - "donations", - "staff", - "other" - ] - }, - "global": { - "bsonType": "bool", - "description": "Flag to indicate wheter this organization is global." - }, - "urls": { - "bsonType": "object", - "description": "Document holding external urls and refs to the organization such as social media profiles.", - "properties": { - "linkedin": { - "bsonType": "string", - "description": "URL to organization's Linkedin page." - }, - "twitter": { - "bsonType": "string", - "description": "URL to organization's Twitter page." - }, - "website": { - "bsonType": "string", - "description": "URL to organization's website." - }, - "playstore": { - "bsonType": "string", - "description": "URL to organization's page at Google Play Store." - }, - "appstore": { - "bsonType": "string", - "description": "URL to organization's page at Apple App Store" - } - }, - "additionalProperties": false - }, - "language": { - "bsonType": "string", - "description": "Field to inidicate the language used by the organization." - } - }, - "additionalProperties": false, - "required": [ - "type", - "industry", - "ownerId", - "name", - "needs" - ] - } - ], - "anyOf": [ - { - "bsonType": "object", - "description": "Case where the user comes from social networks with a registration that uses email. In this case, the email field is required. This case covers the great majority of currently supported social network authentications.", - "properties": { - "email": { - "bsonType": "string", - "description": "User's email validated by a regex pattern." - } - }, - "additionalProperties": true, - "required": [ - "email" - ] - }, - { - "bsonType": "object", - "description": "Case where the user comes from social networks with a registration that allows the use of only the phone. In this case, the phone field is required, and the email isn't. \n\nAn example of ocial network that falls into this case is Twitter.", - "properties": { - "phone": { - "bsonType": "string" - } - }, - "additionalProperties": false, - "required": [ - "phone" - ] - } - ], - "required": [ - "createdAt", - "_id", - "updatedAt", - "authId" - ] - } - }, - "validationLevel": "off", - "validationAction": "warn" +use applicationDB; + +db.runCommand({ + "collMod": "users", + "validator": { + "$jsonSchema": { + "bsonType": "object", + "title": "users", + "description": "Collection that holds all the data on system's users. \n\nThe users can be of **two types**: **(1) Individual**, representing a private user account; and **(2) Organization**, representing an organization of various types.\n\nThe field 'type' is used to differentiate between the two subschemas, with 'individual' representing private user accounts and \"Community\", \"Government\", \"Health care provider\", \"Non-profit\", \"Other\", \"R&D\", \"Startup\", \"Traditional Company\" and \"University\".", + "additionalProperties": true, + "properties": { + "_id": { + "bsonType": "objectId", + "description": "Automatically generated _it as primary key." + }, + "createdAt": { + "bsonType": "date", + "description": "Timestamp with the user's creation date" + }, + "updatedAt": { + "bsonType": "date", + "description": "Timestamp indicating last update on the database." + }, + "authId": { + "bsonType": "string", + "description": "String holding the authentication service id (Auth0).\n\nThis field is a **foreign key to the user in the Auth0 database**, connecting through the user_id field." + }, + "location": { + "bsonType": "object", + "description": "Location document according to the norms of a [GeoJSON Object](https://docs.mongodb.com/manual/reference/geojson/ ).\nThe fields address, neighborhood, city, state and country are added to store the result of the geoprocessing.", + "properties": { + "coordinates": { + "bsonType": "array", + "description": "Array with the coordinates, specifying **longitude first** and **latitude second**, as default in the [GeoJSON](https://docs.mongodb.com/manual/reference/geojson/) definition.", + "additionalItems": true, + "minItems": 2, + "maxItems": 2, + "uniqueItems": false, + "items": [ + { + "bsonType": "number", + "description": "Location longitude\n", + "minimum": -180, + "maximum": 180 + }, + { + "bsonType": "number", + "description": "Location latitude\n", + "minimum": -90, + "maximum": 90 + } + ] + }, + "type": { + "bsonType": "string", + "description": "Type of the GeoJSON Object.\nPlease refer to the [official documentation](https://docs.mongodb.com/manual/reference/geojson/ ) for more information.\n\n**In our case, the value will always be of the type \"Point\".**", + "enum": [ + "Point" + ] + }, + "country": { + "bsonType": "string", + "description": "String holding the country's name.\n" + }, + "city": { + "bsonType": "string", + "description": "String holding the city's name." + }, + "neighborhood": { + "bsonType": "string", + "description": "String holding the neighborhood's name." + }, + "address": { + "bsonType": "string", + "description": "String holding the address (street, number and other details)." + } + }, + "additionalProperties": false, + "required": [ + "coordinates", + "type" + ] + }, + "about": { + "bsonType": "string", + "description": "Small self-introduction, limited to 100 char" + }, + "photo": { + "bsonType": "string", + "description": "URI with the location of the profile's photo." + }, + "acceptedPrivacyAt": { + "bsonType": "timestamp" + }, + "acceptedTermsAt": { + "bsonType": "timestamp" + } + }, + "oneOf": [ + { + "bsonType": "object", + "description": "Subschema representing a individual account.", + "properties": { + "type": { + "bsonType": "string", + "enum": [ + "individual" + ] + }, + "firstName": { + "bsonType": "string", + "description": "The first name of the user" + }, + "lastName": { + "bsonType": "string", + "description": "The last name of the user. Optional field." + }, + "needs": { + "bsonType": "object", + "description": "User's need in the app, representing what kind of help he/she needs", + "properties": { + "medicalHelp": { + "bsonType": "bool", + "description": "Flag to indicate wheter the user needs medical help. \nMarking this indicates he shows symptoms of COVID-19." + }, + "otherHelp": { + "bsonType": "bool", + "description": "Flag to indicate wheter the user needs non-medical help, such as getting groceries, medice and etc.." + } + }, + "additionalProperties": false, + "required": [ + "medicalHelp", + "otherHelp" + ] + }, + "objectives": { + "bsonType": "object", + "description": "Document with what are the objectives of the user through the application, such as donating, volunteering or sharing information.", + "properties": { + "volunteer": { + "bsonType": "bool", + "description": "Flag to indicate wheter the user wants to volunteer for iniciatives through the app." + }, + "donate": { + "bsonType": "bool", + "description": "Flag to indicate wheter the user wants to donate for iniciatives through the app." + }, + "shareInformation": { + "bsonType": "bool", + "description": "Flag to indicate wheter the user wants to share information through the app." + } + }, + "additionalProperties": false, + "required": [ + "volunteer", + "donate", + "shareInformation" + ] + }, + "urls": { + "bsonType": "object", + "description": "Document holding the user urls to external websites and social networks", + "properties": { + "facebook": { + "bsonType": "string", + "description": "URL to user's Facebook page." + }, + "linkedin": { + "bsonType": "string", + "description": "URL to user's Linkedin page." + }, + "twitter": { + "bsonType": "string", + "description": "URL to user's Twitter page." + }, + "github": { + "bsonType": "string", + "description": "URL to user's Github page." + }, + "website": { + "bsonType": "string", + "description": "URL to user's personal website." + } + }, + "additionalProperties": false + } + }, + "additionalProperties": true, + "required": [ + "type", + "firstName", + "needs" + ] + }, + { + "bsonType": "object", + "description": "Subschema representing an organization (colective) account.", + "properties": { + "type": { + "bsonType": "string", + "description": "The type of the organization. Can be: Community, Government, Health care provider, Non-profit, Other, R&D, Startup, Traditional Company and University. All names are store in lowercase only.", + "enum": [ + "startup", + "traditional company", + "community", + "government", + "r&d", + "non-profit", + "university", + "health care provider", + "other" + ] + }, + "industry": { + "bsonType": "string", + "description": "Industry from which the organization participates. Plan is for this values to be scraped from linkedin industries." + }, + "ownerId": { + "bsonType": "objectId", + "description": "_id of the user who owns the organization." + }, + "name": { + "bsonType": "string", + "description": "Organization's name.\n" + }, + "needs": { + "bsonType": "object", + "description": "Document with what are the objectives of the organization through the application, such as finding volunteers, staff, investors and donors.", + "properties": { + "volunteers": { + "bsonType": "bool", + "description": "Flag to indicate wheter the organization is seeking volunteers through the app." + }, + "donations": { + "bsonType": "bool", + "description": "Flag to indicate wheter the organization is seeking donations through the app." + }, + "staff": { + "bsonType": "bool", + "description": "Flag to indicate wheter the organization is seeking staff through the app." + }, + "other": { + "bsonType": "bool", + "description": "Flag to indicate wheter the organization is seeking other needs through the app." + } + }, + "additionalProperties": false, + "required": [ + "volunteers", + "donations", + "staff", + "other" + ] + }, + "global": { + "bsonType": "bool", + "description": "Flag to indicate wheter this organization is global." + }, + "urls": { + "bsonType": "object", + "description": "Document holding external urls and refs to the organization such as social media profiles.", + "properties": { + "linkedin": { + "bsonType": "string", + "description": "URL to organization's Linkedin page." + }, + "twitter": { + "bsonType": "string", + "description": "URL to organization's Twitter page." + }, + "website": { + "bsonType": "string", + "description": "URL to organization's website." + }, + "playstore": { + "bsonType": "string", + "description": "URL to organization's page at Google Play Store." + }, + "appstore": { + "bsonType": "string", + "description": "URL to organization's page at Apple App Store" + } + }, + "additionalProperties": false + }, + "language": { + "bsonType": "string", + "description": "Field to inidicate the language used by the organization." + } + }, + "additionalProperties": false, + "required": [ + "type", + "industry", + "ownerId", + "name", + "needs" + ] + } + ], + "anyOf": [ + { + "bsonType": "object", + "description": "Case where the user comes from social networks with a registration that uses email. In this case, the email field is required. This case covers the great majority of currently supported social network authentications.", + "properties": { + "email": { + "bsonType": "string", + "description": "User's email validated by a regex pattern." + } + }, + "additionalProperties": true, + "required": [ + "email" + ] + }, + { + "bsonType": "object", + "description": "Case where the user comes from social networks with a registration that allows the use of only the phone. In this case, the phone field is required, and the email isn't. \n\nAn example of ocial network that falls into this case is Twitter.", + "properties": { + "phone": { + "bsonType": "string" + } + }, + "additionalProperties": false, + "required": [ + "phone" + ] + } + ], + "required": [ + "createdAt", + "_id", + "updatedAt", + "authId", + "acceptedPrivacyAt", + "acceptedTermsAt" + ] + } + }, + "validationLevel": "off", + "validationAction": "warn" }); \ No newline at end of file