Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e3b07bc
chore: setup project
DidiNugroho Sep 30, 2024
586fae6
setting up sequelize migration
DidiNugroho Sep 30, 2024
d793611
feat: add helper function for hashing password
DidiNugroho Sep 30, 2024
92413d5
feat: add jwt helper for token
DidiNugroho Sep 30, 2024
0213a2a
chore: setting up routes
DidiNugroho Sep 30, 2024
adf3a63
chore: setting up models associate
DidiNugroho Sep 30, 2024
d08905f
feat: add register endpoint
DidiNugroho Sep 30, 2024
1f3ab14
feat: add login feature
DidiNugroho Sep 30, 2024
2743ab9
feat: added google login and error handler
DidiNugroho Oct 1, 2024
78e50e9
feat: add finding user anime list
DidiNugroho Oct 1, 2024
ae8f41b
feat: adding function to add anime to a user list
DidiNugroho Oct 1, 2024
bfd7768
feat: adding function to delete anime from a user list
DidiNugroho Oct 1, 2024
d5c622c
feat: finishing endpoints for Anime models
DidiNugroho Oct 2, 2024
7d77f8e
feat: add authentication middleware
DidiNugroho Oct 2, 2024
20f5fcb
feat: add gemini ai endpoint
DidiNugroho Oct 2, 2024
64b599c
test: added jest test
DidiNugroho Oct 3, 2024
c586f1e
chore: tidying up code
DidiNugroho Oct 3, 2024
53337c7
docs: added api docs
DidiNugroho Oct 3, 2024
9051b9c
chore: add dialect to production config
DidiNugroho Oct 3, 2024
93c190c
chore: modify port
DidiNugroho Oct 3, 2024
e9d9030
chore: modifying cors to allow all origin
DidiNugroho Oct 3, 2024
d2641db
chore: modifying app.js
DidiNugroho Oct 3, 2024
2d3269a
chore: modifying app.js
DidiNugroho Oct 3, 2024
75b3100
chore: modifying app.js
DidiNugroho Oct 3, 2024
24bc65d
chore: modifying app.js
DidiNugroho Oct 3, 2024
18a8154
chore: modifying app.js
DidiNugroho Oct 3, 2024
dc306a7
docs: finishing api docs
DidiNugroho Oct 3, 2024
f030612
chore: modifying AnimeController.js
DidiNugroho Oct 3, 2024
4b9feed
chore: just a test
DidiNugroho Oct 3, 2024
d53564f
chore: just a test
DidiNugroho Oct 3, 2024
10e0386
refactor: moving fetching data from 3rd API to client-side
DidiNugroho Oct 4, 2024
a37c0bf
docs: adding endpoint doc
DidiNugroho Oct 4, 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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
JWT_SECRET=
G_CLIENT_ID=
G_CLIENT_SECRET=
GOOGLE_AI_API_KEY=
388 changes: 388 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,390 @@
# IP-RMT-53-Server

Individual Project RMT-53 Server Side

# AniTrackr. App Server

## RESTful endpoints

### POST /register

> Post user register

_Request Header_

```
not needed
```

_Request Body_

```
{
"username": "<user username>",
"email": "<user email>",
"password": "<user password>"
}
```

_Response (201)_ - User Created / Register Success

```
{
"id": "<user id>,
"email": "<user email>",
}
```

### POST /login

> Post user login

_Request Header_

```
not needed
```

_Request Body_

```
{
"email": "<user email>",
"password": "<user password>"
}
```

_Response (200)_ - Login Success

```
{
"access_token": "<access token>,
"id": "<user id>,
"username": "<user username>,
"email": "<user email>",
}
```

### POST /google-login

> Post user login with google

_Request Header_

```
{
"google_token": "<user google token>"
}
```

_Request Body_

```
not needed
```

_Response (200)_ - Login Success

```
{
"access_token": "<access token>,
"id": "<user id>,
"username": "<user username>,
"email": "<user email>",
}
```

### POST /api/chat

> Post chatbot for anime recommendation based on user question

_Request Header_

```
not needed
```

_Request Body_

```
prompt: <user prompt>
```

_Response (200)_ - Login Success

```
{
"message": "Gemini AI Chatbot replied successfully",
"recommendation": "<chatbot reply(recommendation)>"
}
```

### GET /anime/search

> Get user searched anime

_Request Header_

```
Authorization: Bearer <user token>
```

_Request Body_

```
not needed
```

_Response (200)_

```
{
"malId": "<anime mal_id>",
"title": "<anime title>",
"genre": "<anime genre>"
"synopsis": "<anime synopsis>",
"episodes": "<anime episodes>",
"imageUrl": "<anime image url>",
"score": "<anime score>",
},
...
```

### GET /anime/:id

> Get user searched anime

_Request Header_

```
not needed
```

_Request Body_

```
not needed
```

_Response (200)_

```
{
"mal_id": "<anime mal_id>",
"title": "<anime title>",
"genre": "<anime genre>"
"synopsis": "<anime synopsis>",
"episodes": "<anime episodes>",
"images": "<anime image>",
"score": "<anime score>",
...
},
```

### POST /api/anime/store

> Post user searched anime to anime database

_Request Header_

```
not needed
```

_Request Body_

```
[
{
"mal_id": "<anime mal_id>",
"title": "<anime title>",
"genre": "<anime genre>"
"synopsis": "<anime synopsis>",
"episodes": "<anime episodes>",
"images": "<anime image>",
"score": "<anime score>",
...
},
...
]

```

_Response (200)_

```
{
message: "Anime data stored successfully",
},
```

### GET /api/user/me

> Get user profile data

_Request Header_

```
not needed
```

_Request Body_

```
not needed
```

_Response (200)_

```
{
"username": "<user username>,
"id": "<user id>,
"email": "<user email>"
},
```

### PUT /api/user/me/username

> Get user profile data

_Request Header_

```
Authorization: Bearer <user token>
```

_Request User_

```
{
"id": <user id>
}
```

_Request Body_

```
{
username: "<new username>"
}
```

_Response (200)_

```
{
message: "Username updated successfully."
},
```

### GET /api/user/me/anime-list

> Get user's anime list

_Request Header_

```
Authorization: Bearer <user token>
```

_Request User_

```
{
"id": <user id>
}
```

_Request Body_

```
not needed
```

_Response (200)_

```
{
"Anime": {episodes: <anime episodes>, ...}
"id": "<anime list id>"
"animeId": "<user anime id>
"userId": "<user id>
},
```

### DELETE /api/user/me/anime-list/:animeId

> Delete selected user's anime from list

_Request Header_

```
Authorization: Bearer <user token>
```

_Request Params_

```
"animeId": "<anime id>"
```

_Request User_

```
{
"id": "<user id>"
}
```

_Request Body_

```
not needed
```

_Response (200)_

```
{
message: "Anime removed from your list successfully"
},
```

### POST /api/user/me/anime-list

> Delete selected user's anime from list

_Request Header_

```
Authorization: Bearer <user token>
```

_Request User_

```
{
"id": "<user id>"
}
```

_Request Body_

```
{
"malId": "<anime id>"
}
```

_Response (201)_ Anime successfully added

```
{
"message": "Anime added to your list successfully",
data: {
"userId": "<user id>",
"animeId": <anime id>,
}
},
```
Loading