Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fb52bd4
setup client
mfaishal82 Mar 12, 2024
f49c10e
setup server
mfaishal82 Mar 12, 2024
f104f2c
setup server and seeding
mfaishal82 Mar 13, 2024
8e58524
setup app and routes
mfaishal82 Mar 13, 2024
d98d07b
feat routes register and login
mfaishal82 Mar 13, 2024
a15e161
feat: authentication & getContent
mfaishal82 Mar 13, 2024
501483c
stuck at association
mfaishal82 Mar 13, 2024
1f50048
refactor migration & association
mfaishal82 Mar 13, 2024
6c570d3
refactor: data migration & seeding
mfaishal82 Mar 14, 2024
3bfc3dd
feat: error handler
mfaishal82 Mar 14, 2024
99b8bfa
feat: routes category done
mfaishal82 Mar 14, 2024
2e374a3
feat: authorization
mfaishal82 Mar 14, 2024
96c3921
feat: isAdmin guard
mfaishal82 Mar 14, 2024
8f415f7
feat: routes content
mfaishal82 Mar 14, 2024
2576907
refactor: routes category
mfaishal82 Mar 14, 2024
19634ed
feat: route pub with 3rd party api
mfaishal82 Mar 14, 2024
6799902
refactor: route pub 3rd party api
mfaishal82 Mar 14, 2024
1efcefb
feat: test >80%
mfaishal82 Mar 14, 2024
2567cd5
feat: progress api docs
mfaishal82 Mar 14, 2024
fd375e8
docs: readme api docs
mfaishal82 Mar 14, 2024
06c8b70
refactor: testing
mfaishal82 Mar 14, 2024
d96b5c9
feat: env
mfaishal82 Mar 15, 2024
a3dd8f9
feat: Home page, public page, login page
mfaishal82 Mar 15, 2024
883cb72
feat: register
mfaishal82 Mar 15, 2024
b871187
refactor: hooks user
mfaishal82 Mar 15, 2024
1426e8c
feat: added 3rd party api with apiKey
mfaishal82 Mar 16, 2024
5bc691b
feat: page pub detail by id
mfaishal82 Mar 16, 2024
f254155
feat: Content page & about us page
mfaishal82 Mar 16, 2024
9b98667
feat: Content page & about us page
mfaishal82 Mar 16, 2024
469116a
feat: login with facebook
mfaishal82 Mar 16, 2024
29eb011
feat: delete content & add content
mfaishal82 Mar 16, 2024
77d1b67
refactor
mfaishal82 Mar 16, 2024
eaa8b96
refactor: global
mfaishal82 Mar 16, 2024
8646ce8
refactor: styling
mfaishal82 Mar 21, 2024
b1c5b71
feat: add routes content post by id
mfaishal82 Mar 21, 2024
6141892
feat: update content by id
mfaishal82 Mar 21, 2024
09f4402
refactor: edit content
mfaishal82 Mar 21, 2024
8560a77
feat: oauth google
mfaishal82 Mar 21, 2024
65d4577
feat: oauth google
mfaishal82 Mar 21, 2024
14872a0
refactor: oauth google
mfaishal82 Mar 21, 2024
dd69368
config server
mfaishal82 Mar 21, 2024
af1ef22
config server
mfaishal82 Mar 21, 2024
6f5acc8
config server
mfaishal82 Mar 21, 2024
f39b044
config server
mfaishal82 Mar 21, 2024
469d1c5
refactor: login google oauth
mfaishal82 Mar 21, 2024
e2f6199
feat: testing
mfaishal82 Mar 21, 2024
94dd7b3
feat: redux
mfaishal82 Mar 22, 2024
6ffbe5c
feat: redux
mfaishal82 Mar 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
382 changes: 381 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,381 @@
# IP-RMT46
# IP-RMT46

Link web: https://ip-mf-d750f.web.app
API server: https://project.mf-cyberse.online/

# API DOCS

## Rest API Endpoints

List of available endpoints:


GET /pub
GET /pub/:id

POST /register
POST /login

GET /contents
POST /contents
PUT /contents/:id
DELETE /contents/:id

GET /categories
GET /categories/:id
POST /categories
PUT /categories/:id
DELETE /categories/:id

## GET /pub

Get public data.

_Response (200 - OK)_

{
data: [
{
"id": "string",
"title": "string",
"translations": [Array]
},
...,
],
"meta":
{
"current_page": "1",
"last_page": 35,
"total_items": 697,
"per_page": 20
}
}

## GET /pub/:id
Get specific public data by Id.

- Request Params:

```
{
id: integer
}
```

_Response (200-OK)_


{
"id": "integer",
"title": "string",
"hadeeth": "text",
"attribution": "string",
"grade": "string",
"explanation": "text",
"hints": [Array],
"categories": [Array],
"translations": [Array]
}

## POST /register
Register a new user

- Request Body

```
{
"username": "string",
"email": "string",
"password": "string"
}
```

_Response (200 - OK)_
```
{
"username": "string",
"email" : "string"
}

## POST /login
Log in an existing user

- Request Body

```
{
"email": "string",
"password": "string"
}
```

_Response (200 - OK)_
```
{
"accessToken": "<access_token>"
}
```

## GET /contents
Get all contents

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Response (200 - OK)_

[
{
"id": "integer",
"title": "string",
"description": "text",
"UserId": "integer",
"CategoryId": "integer",
"createdAt": "date",
"updatedAt": "date",
"Category": {
"id": "integer",
"name": "String",
"createdAt": "date",
"updatedAt": "date"
}
}
]

## GET /contents/:id
Get content by id

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Request Params_

{
"id" : "integer"
}

_Response (200 - OK)_

{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}

## POST /contents
Create a new content

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Request Body_

{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}

_Response (200 - OK)_

{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}


## PUT /contents/:id
Update content by Id

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Request Params_

{
"id": "integer"
}

_Request Body_

{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}

_Response (200 - OK)_

{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}


## DELETE /contents/:id
Delete content by Id

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Request Params_

{
"id": "integer"
}

_Request Body_

{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}

_Response (200 - OK)_

{
message: `Deleted content <content.title>`
}

## GET /categories
Get all categories

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Response (200 - OK)_

[
{
"name": "string"
},
...,
]

## GET /categories/:id
Get specific category by Id

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Request Params_

{
"id" : "integer"
}

_Response (200 - OK)_

{
"name" : "string"
}

## POST /categories
Create a new category (only admin)

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Request Body_

{
"name": "string"
}

_Response (200 - OK)_

{
"name": "string"
}

## PUT /categories/:id
Update category by Id

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Request Params_

{
"id": "integer"
}

_Request Body_

{
"name": "string"
}

_Response (200 - OK)_

{
"name": "string"
}


## DELETE /categories/:id
Delete category by Id

- headers:
```json
{
"Authorization": "Bearer <access_token>"
}
```

_Request Params_

{
"id": "integer"
}

_Request Body_

{
"name": "string"
}

_Response (200 - OK)_

{
"name": "string"
}
Loading