Skip to content

Commit

Permalink
Merge pull request #6 from al-bertes/module5-task1
Browse files Browse the repository at this point in the history
  • Loading branch information
keksobot authored Oct 9, 2024
2 parents 582b82e + 7e65d2d commit abbae5e
Show file tree
Hide file tree
Showing 26 changed files with 527 additions and 12 deletions.
7 changes: 7 additions & 0 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"watch": [
"src"
],
"ext": "ts, json",
"exec": "npm run ts ./src/main.rest.ts | pino-pretty --colorize --translateTime SYS:standard"
}
198 changes: 198 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
],
"main": "main.js",
"scripts": {
"start:dev": "npm run ts ./src/main.rest.ts | pino-pretty --colorize --translateTime SYS:standard",
"start": "npm run build && node ./dist/main.rest.js",
"start:dev": "nodemon",
"build": "npm run clean && npm run compile",
"lint": "eslint src/ --ext .ts",
"compile": "tsc -p tsconfig.json",
Expand All @@ -28,6 +29,7 @@
"eslint": "8.49.0",
"eslint-config-htmlacademy": "9.1.1",
"lodash": "^4.17.21",
"nodemon": "^3.1.7",
"prettier": "^3.3.3",
"rimraf": "5.0.1",
"ts-node": "10.9.2",
Expand Down
64 changes: 64 additions & 0 deletions specification/project.spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
openapi: 3.1.0
info:
title: API Server for Demo Project "Six Cities"
description: |-
* List of resources and routes for the "Six Cities" server.
license:
name: MIT
url: https://opensource.org/licenses/MIT
version: 2.0.0
tags:
- name: offers
description: Actions related to offers.
- name: comments
description: Actions related to comments.
- name: users
description: Actions related to the user.
paths:
/users/register:
post:
tags:
- users
summary: User registration
description: Registers a new user.

requestBody:
description: Information for creating a new user.
content:
application/json:
schema:
$ref: '#/components/schemas/createUser'
required: true

responses:
"201":
description: User registered. User object.
content:
application/json:
schema:
$ref: '#/components/schemas/user'

"409":
description: A user with this email already exists.


/users/login:
post:
tags:
- users
summary: User authentication
description: Authenticates a user based on login and password.

get:
tags:
- users
summary: User status check
description: Returns information about the authenticated user.

/users/{userId}/avatar:
post:
tags:
- users
summary: Upload avatar image
description: Uploads the user's avatar image. The avatar image must be in
`png` or `jpg` format.
2 changes: 2 additions & 0 deletions src/main.rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { Component } from './shared/types/index.js';
import { createRestApplicationContainer } from './rest/rest.container.js';
import { createUserContainer } from './shared/modules/user/index.js';
import { createOfferContainer } from './shared/modules/offer/index.js';
import { createCommentContainer } from './shared/modules/comment/index.js';

async function bootstrap() {
const appContainer = Container.merge(
createRestApplicationContainer(),
createUserContainer(),
createOfferContainer(),
createCommentContainer(),
);

const application = appContainer.get<RestApplication>(Component.RestApplication);
Expand Down
1 change: 1 addition & 0 deletions src/shared/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const TSV_SEPARATOR = '|';
Loading

0 comments on commit abbae5e

Please sign in to comment.