Skip to content
Permalink
Browse files
user schema added
  • Loading branch information
skondram committed Nov 24, 2021
1 parent c423347 commit 9c67cd517e5db01048919e6739c62b5971b41475
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 2 deletions.

Some generated files are not rendered by default. Learn more.

@@ -16,6 +16,7 @@
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"koa-router": "^10.1.1",
"promise-mysql": "^5.0.4"
"promise-mysql": "^5.0.4",
"uuid": "^8.3.2"
}
}
@@ -0,0 +1,170 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {


"user": {
"$id": "#user",
"title": "User",
"description": "Data to register a new user.",
"type": "object",
"properties": {
"firstName": {
"description": "First name",
"type": "string"
},
"lastName": {
"description": "Last name",
"type": "string"
},
"about": {
"description": "Description of the user",
"type": "string"
},
"email": {
"description": "Unique email address",
"type": "string",
"format": "email"
},
"avatarURL": {
"description": "URL of avatar image",
"type": "string",
"format": "uri"
},
"username": {
"description": "Unique username",
"type": "string",
"minLength": 3
},
"password": {
"description": "Password for registration",
"type": "string",
"minLength": 6
}
},
"required": ["username", "email", "password"],
"additionalProperties": false
},


"userView": {
"$id": "#userView",
"title": "User View",
"description": "Data visible to users and admins (excludes password).",
"type": "object",
"properties": {
"firstName": {
"description": "First name",
"type": "string"
},
"lastName": {
"description": "Last name",
"type": "string"
},
"about": {
"description": "Description of the user",
"type": "string"
},
"email": {
"description": "Unique email address",
"type": "string"
},
"avatarURL": {
"description": "URL of avatar image",
"type": "string"
},
"username": {
"description": "Unique username",
"type": "string"
}
}
},


"userUpdate": {
"$id": "#userUpdate",
"title": "User Update",
"description": "Data a user can update (excludes username).",
"type": "object",
"properties": {
"firstName": {
"description": "First name",
"type": "string"
},
"lastName": {
"description": "Last name",
"type": "string"
},
"about": {
"description": "Description of the user",
"type": "string"
},
"email": {
"description": "Unique email address",
"type": "string",
"format": "email"
},
"avatarURL": {
"description": "URL of avatar image",
"type": "string",
"format": "uri"
},
"password": {
"description": "Password for registration",
"type": "string",
"minLength": 6
}
},
"additionalProperties": false
},


"userList": {
"$id": "#userList",
"title": "User List",
"description": "List of all users visible to admin only.",
"type": "array",
"items": {"$ref": "#/definitions/userView"}
},


"userUpdated": {
"$id": "#userUpdated",
"title": "User Updated",
"description": "Confirmation of a successful user update/creation",
"type": "object",
"properties": {
"ID": {
"description": "ID of the updated user record",
"type": "integer"
},
"updated": {
"description": "Boolean indicator of success",
"type": "boolean"
},
"link": {
"description": "Path to retrieve user record",
"type": "string",
"format": "uri"
}
}
},


"userDeleted": {
"$id": "#userDeleted",
"title": "User Deleted",
"description": "Confirmation of a successful deletion",
"type": "object",
"properties": {
"ID": {
"description": "ID of the updated user record",
"type": "integer"
},
"deleted": {
"description": "Boolean indicator of success",
"type": "boolean"
}
}
}
}
}

0 comments on commit 9c67cd5

Please sign in to comment.