Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mehradaotp/ticket
Working with api ticket and event along with authentication
https://github.com/mehradaotp/ticket
javascript js nestjs typescript typescript-b
Last synced: about 1 month ago
JSON representation
Working with api ticket and event along with authentication
- Host: GitHub
- URL: https://github.com/mehradaotp/ticket
- Owner: MehradAotp
- License: mit
- Created: 2024-10-02T20:11:10.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-10-29T19:07:07.000Z (3 months ago)
- Last Synced: 2024-10-29T21:21:19.714Z (3 months ago)
- Topics: javascript, js, nestjs, typescript, typescript-b
- Language: TypeScript
- Homepage:
- Size: 453 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Description
This project is to simulate and understand NestJS concepts.
## Project setup
```bash
$ yarn install
```## Compile and run the project
```bash
# development
$ yarn run start# watch mode
$ yarn run start:dev# production mode
$ yarn run start:prod
```# Easy documentation
http://localhost:3000/api## Working with this API
First REGISTER User in Postman.http://localhost:3000/users POST
Example Data From Body:
```json
"username" : "example",
"password" : "password123",
"email" : "example@gmail.com"
```
after register you can LOGIN and get token jwturl : http://localhost:3000/auth/login POST
Example Data From Body :
```json
"username" : "example",
"password" : "password123"
```After logging in, a code will be sent to your email
And you should send to the following address with this methodurl : http://localhost:3000/auth/verify-otp
and Example data from body :
```json
"email": "Example@gmail.com",
"otp": "773120"
```and get example token :
```json
"access_token" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Im1laHJhZDMiLCJpYXQiOjE3Mjc5MDA2MTIsImV4cCI6MTcyNzkwNDIxMn0.gaVp4qIXZsjk0gW2-gdyrybIRnufSP0F4tobmjWl-Do"
```
event(example cinema Or ...)
Create event.url : http://localhost:3000/events POST
Example Data From Body :
```json
"title": "Joker",
"description": "Live TV ",
"date": "2024-10-15T19:30:00Z",
"location": "Stadium A",
"price": 836
```
and update data :
http://localhost:3000/events PATCH
Example Data From Body :
```json
"title": "Mokhtar",
"description": "Live Tv.",
"date": "2024-10-15T19:30:00Z",
"location": "Stadium A",
"price": 50
```
**Get all event and event by id**http://localhost:3000/events GET
For all Data Send Empty Data . but for get by id Send eventId In Param
Example :
http://localhost:3000/events/66fd15ae3802e4409738f01e GETAnd you can delete the event like get by id but use delete instead of get
Example :
http://localhost:3000/events/66fd15ae3802e4409738f01e DELETE
Ticket
like events but different Route
Create Ticket.
http://localhost:3000/tickets POST```json
"username" : "mmd",
"eventId" :"66fd3408fa864887efce0b5d",
"quantity" : 6
```
All Ticket AND Get Ticket By ID In Param GET
and Delete Ticket By Id In Param DELETE# Profile
Now you can Create Profile And Upload Photo! And You need Use Token Jwturl : http://localhost:3000/profiles/ POST
And Example Data From Body:
```json
{
"userId" : "66fff0ee47a771846d71dfc9",
"bio" : "Profile Example"
}
```
Well, now you have created your profile and now it's time to upload a photo!url : http://localhost:3000/profiles/upload/66fda7fbb76d4728ea2e99a0 POST
Here you need to enter your id in param and then in send header information set field value as "file" and then upload your photo and send request.
**Get Profile**
you can Get Profile. Data From PARAM
url : http://localhost:3000/profiles/66fda7fbb76d4728ea2e99a0 GET## Authentication
After logging in, you will get a token. and expire in 1h
Now you have to put that token in the Authorization tab of the Bearer Token type
Example Jwt :
```json
"access_token" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Im1laHJhZDMiLCJpYXQiOjE3Mjc5MDA2MTIsImV4cCI6MTcyNzkwNDIxMn0.gaVp4qIXZsjk0gW2-gdyrybIRnufSP0F4tobmjWl-Do"
```## License
[MIT licensed](https://github.com/MehradAotp/ticket/blob/master/LICENSE).