Skip to content

Endpoint and Data Model Documentation

gumityolcu edited this page Nov 7, 2018 · 19 revisions

This document explains the current situation regarding our data models and endpoints. The document will be updated with changes over time.

1. Data Models

1.1. User

1.1.1. Fields

1.1.1.1 E-mail

  • Name : email
  • Type : String
  • Required : True
  • Unique : True

1.1.1.2. First name

  • Name : firstName
  • Type : String
  • Required : True
  • Unique : False

1.1.1.3. Last name

  • Name : lastName
  • Type : String
  • Required : True
  • Unique : False

1.1.1.4. Password

  • Name : password
  • Type : String
  • Required : True
  • Unique : False Comments:Password is hashed before saving or comparing

1.1.2. CRUD Endpoints

  • 1.1.2.1. Create : POST /api/auth/signup
  • 1.1.2.2. Read : GET /api/users/:id (THIS IS NOT YET MERGED TO MASTER!)
  • 1.1.2.3. Update : Not implemented
  • 1.1.2.4. Delete : Not implemented

1.2. Event

1.2.1. Fields

1.2.1.1 Name

  • Name : name
  • Type : String
  • Required : True
  • Unique : False

1.2.1.2. Price

  • Name : price
  • Type : Number
  • Required : True
  • Unique : False

1.2.1.3. Description

  • Name : description
  • Type : String
  • Required : True
  • Unique : False

1.2.1.4. Date

  • Name : date
  • Type : MongoDB date
  • Required : True
  • Unique : False

1.2.1.5. Owner

  • Name : owner
  • Type : String(Mongo object ID)
  • Required : True
  • Unique : False

1.2.1.6. Artists

  • Name : artists
  • Type : Array of strings
  • Required : False
  • Unique : False

1.2.1.7. Users that will attend

  • Name : willAttendUser
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.1.8. Users that may attend

  • Name : maybeAttendUser
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.1.9. Users that will/did not attend

  • Name : notAttendUser
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.1.10. Users that did attend

  • Name : attendedUser
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.1.11. Blocked users

  • Name : blockedUsers
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.2. CRUD Endpoints

  • 1.2.2.1. Create : POST /api/events
  • 1.2.2.2. Read : GET /api/events/:id or GET /api/events/getEventbyOwner/:id
  • 1.2.2.3. Update : GET /api/events/:id
  • 1.2.2.4. Delete : DELETE /api/events/:id (THIS IS NOT YET MERGED TO MASTER!)
2. Endpoints This document explains the current situation regarding our data models and endpoints. The document will be updated with changes over time.
1. Data Models

1.1. User

1.1.1. Fields

1.1.1.1 E-mail

  • Name : email
  • Type : String
  • Required : True
  • Unique : True

1.1.1.2. First name

  • Name : firstName
  • Type : String
  • Required : True
  • Unique : False

1.1.1.3. Last name

  • Name : lastName
  • Type : String
  • Required : True
  • Unique : False

1.1.1.4. Password

  • Name : password
  • Type : String
  • Required : True
  • Unique : False Comments:Password is hashed before saving or comparing

1.1.2. CRUD Endpoints

  • 1.1.2.1. Create : POST /api/auth/signup
  • 1.1.2.2. Read : GET /api/users/:id (THIS IS NOT YET MERGED TO MASTER!)
  • 1.1.2.3. Update : Not implemented
  • 1.1.2.4. Delete : Not implemented

1.2. Event

1.2.1. Fields

1.2.1.1 Name

  • Name : name
  • Type : String
  • Required : True
  • Unique : False

1.2.1.2. Price

  • Name : price
  • Type : Number
  • Required : True
  • Unique : False

1.2.1.3. Description

  • Name : description
  • Type : String
  • Required : True
  • Unique : False

1.2.1.4. Date

  • Name : date
  • Type : MongoDB date
  • Required : True
  • Unique : False

1.2.1.5. Owner

  • Name : owner
  • Type : String(Mongo object ID)
  • Required : True
  • Unique : False

1.2.1.6. Artists

  • Name : artists
  • Type : Array of strings
  • Required : False
  • Unique : False

1.2.1.7. Users that will attend

  • Name : willAttendUser
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.1.8. Users that may attend

  • Name : maybeAttendUser
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.1.9. Users that will/did not attend

  • Name : notAttendUser
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.1.10. Users that did attend

  • Name : attendedUser
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.1.11. Blocked users

  • Name : blockedUsers
  • Type : Array of Mongo object IDs
  • Required : False
  • Unique : False

1.2.2. CRUD Endpoints

  • 1.2.2.1. Create : POST /api/events
  • 1.2.2.2. Read : GET /api/events/:id or GET /api/events/getEventbyOwner/:id
  • 1.2.2.3. Update : GET /api/events/:id
  • 1.2.2.4. Delete : DELETE /api/events/:id (THIS IS NOT YET MERGED TO MASTER!)
2. Endpoints This sections lists the names of the endpoints and their inputs

2.1. /api/auth

2.1.1. POST /api/auth/signup

2.1.1.1. URL inputs:

  • None

2.1.1.2. Body inputs:

  • email
  • firstName
  • lastName
  • password

##2.1.2. POST /api/auth/signin

2.1.2.1. URL inputs:

  • None

2.1.2.2. Body inputs:

  • email
  • password

##2.1.3. GET /api/auth/signout

2.1.3.1. URL inputs:

  • None

2.1.3.2. Body inputs:

  • None

2.2. /api/users

##2.2.1. GET /api/users/:id (THIS IS NOT YET MERGED WITH MASTER!)

2.2.1.1. URL inputs:

  • id

2.2.1.2. Body inputs:

  • None

2.3. /api/events

##2.3.1. POST /api/events ###2.3.2.1. URL inputs:

  • None ###2.3.2.2. Body inputs:
  • name
  • price
  • owner
  • artists
  • description
  • date

##2.3.2. GET /api/events

2.3.2.1. URL inputs:

  • None

2.3.2.2. Body inputs:

  • None

##2.3.3. GET /api/events/getEventbyOwner/:id

2.3.3.1. URL inputs:

  • id

2.3.3.2. Body inputs:

  • None

##2.3.4. GET /api/events/:id

2.3.4.1. URL inputs:

  • id

2.3.4.2. Body inputs:

  • None

##2.3.5. PUT /api/events/:id ###2.3.5.1. URL inputs:

  • id ###2.3.5.2. Body inputs:
  • name
  • price
  • description
  • date
  • artists
  • blokedUsers

##2.3.6. DELETE /api/events/:id (THIS IS NOT YET MERGED WITH MASTER!) ###2.3.6.1 URL inputs:

  • id ###2.3.6.2. Body inputs:
  • None
Clone this wiki locally