# E-KYC using Block Chain Documentation
## Models
### 1. Users
```javascript=1
const UserSchema = new Schema({
name: {
type: String,
required: true,
},
username: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
date: {
type: String,
default: Date.now,
},
})
```
### 2. Institutions
```javascript=1
const InstitutionSchema = new Schema({
name: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
date: {
type: String,
default: Date.now,
},
})
```
## End points
### **1.Clients**
#### 1.1
| Name | Type | Request | Response |
| --------- |:---- | --- | --- |
| /registerClient | post | email, name, password, DOB, ID number | jwt token |
<br/>
| Status Codes | Message |
| ----------------- |:----------------------- |
| 200 | Success |
| 400 | Email Already Exists
| 500 | Internal Server Error|
:bulb: **what it does:** help register a new user by adding the details in the user table
#### 1.2
| Name | Type | Request | Response |
| --------- |:---- | --- | --- |
| /login | post | email, password, user type | jwt token |
<br/>
| Status Codes | Message |
| ------------ |:--------------------------- |
| 200 | Success |
| 404 | Email Does not Exist |
| 401 |Invalid Credentials |
| 500 | Internal Server Error|
:bulb: **what it does:** helps login a registered user by matching the password
<br/>
#### 1.3
| Name | Type | Request | Response |
| --------- |:---- | --- | --- |
| /getClientData | get | org number,ledger user,ledger ID | client details |
<br/>
| Status Codes | Message |
| ------------ |:--------------------------- |
| 200 | Success |
| 404 | Client Does not Exist |
| 401 |Invalid Credentials |
| 500 | Internal Server Error|
:bulb: **what it does:** returns data of the client
<br/>
### **2. Institutions**
#### 2.1
| Name | Type | Request | Response |
| --------- |:---- | --- | --- |
| /registerInstitution| post | name, password |jwt token |
<br/>
| Status Codes | Message |
| ------------ |:----------------- |
| 200 | Success |
| 401 |Authorization Error |
| 500 | Internal Server Error|
:bulb: **what it does:** Registers a new financial institution
<br/>
#### 2.2
| Name | Type | Request | Response |
| --------- |:---- | --- | --- |
| /getInstitutionData| get | org number,ledger user |Financial Institution Data |
<br/>
| Status Codes | Message |
| ------------ |:----------------- |
| 200 | Success |
| 404 |Data Not found |
| 500 | Internal Server Error|
:bulb: **what it does:** Gets details of financial institution
<br/>
### FLOW CHART

