Skip to content

Commit

Permalink
chore: fix swagger and docs (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtrindade authored Sep 8, 2024
1 parent 2dbe843 commit 64e35e1
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 131 deletions.
53 changes: 0 additions & 53 deletions .gitattributes

This file was deleted.

123 changes: 61 additions & 62 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,61 @@
site_name: LunaCrew | Accounts-core
site_description: Accounts Core API - Luna's User Management
site_author: LunaCrew
site_url: https://lunacrew.github.io/accounts-core

repo_name: GitHub
repo_url: https://github.com/LunaCrew/accounts-core

docs_dir: pages
site_dir: site

nav:
- Home: index.md
- API: api.md
- Architecture: architecture.md
- Contribute: contribute.md
- Stacks: stacks.md
- References: references.md

theme:
name: material
icon:
repo: fontawesome/brands/github
admonition:
type: material/alert-circle
logo: assets/luna.png
favicon: assets/luna.png

palette:
# Default color palette
- scheme: default
toggle:
icon: material/weather-night
name: Switch to dark mode
primary: brown
accent: blue

# Palette toggle for dark mode
- scheme: slate
toggle:
icon: material/weather-sunny
name: Switch to light mode
primary: brown
accent: blue

features:
- navigation.footer
- navigation.top
# - toc.integrate

extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/LunaCrew

markdown_extensions:
- admonition
- attr_list
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
site_name: LunaCrew | Accounts-core
site_description: Accounts Core API - Luna's User Management
site_author: LunaCrew
site_url: https://lunacrew.github.io/accounts-core

repo_name: GitHub
repo_url: https://github.com/LunaCrew/accounts-core

docs_dir: pages
site_dir: site

nav:
- Home: index.md
- API: api.md
- Architecture: architecture.md
- Contribute: contribute.md
- Stacks: stacks.md
- References: references.md

theme:
name: material
icon:
repo: fontawesome/brands/github
admonition:
type: material/alert-circle
logo: assets/luna.png
favicon: assets/luna.png

palette:
# Default color palette
- scheme: default
toggle:
icon: material/weather-night
name: Switch to dark mode
primary: brown
accent: indigo

# Palette toggle for dark mode
- scheme: slate
toggle:
icon: material/weather-sunny
name: Switch to light mode
primary: brown
accent: indigo

features:
- navigation.footer
- navigation.top

extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/LunaCrew

markdown_extensions:
- admonition
- attr_list
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
76 changes: 74 additions & 2 deletions docs/pages/api.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,76 @@
# API

!!! warning "In construction"
This page is under construction. Please check back later.
The `accounts-core` api provides management of the user accounts and transactional emails.

## Create user

Creates a new user with the schema bellow:

!!! note "**POST**: `/api/user`"
```json
{
"name": "string",
"email": "[email protected]",
"password": "stringst",
"settings": {
"theme": "dark", // default
"animations": true, // default
"notificationType": "popup", // default
"speechType": "neutral", // default
"mfa": false, // default
"language": "en-us" // default
}
}
```

## Get user

Retrieve user data.

!!! abstract "**GET** `/api/user?params`"
- id: `uuid`
- email: `string`

## Login

Generates the session token for the user from its email.

!!! info "**POST**: `/api/auth/login/:email`"
- **email**: `string`

## Update user

Update one or more user configuration field.

!!! note "**PATCH**: `/api/user/:id`"
- **id**: `uuid`

## Disable user

Disable the user account and schedule it for exclusion.

!!! warning "**POST**: `/api/user/:id`"
- **id**: `uuid`

## Delete user

Permanently deletes the user account.

!!! danger "**DELETE**: `/api/user/:id`"
- **id**: `uuid`

## Validate email

Validate the email used on account creation.

!!! info "**POST**: `/api/auth/email/validate/:id/:token`"
- **id**: `uuid`
- **token**: generated on account creation with 8 digits and alphanumeric.

## Send verification code to email

Send a new token to the user email. If `isEmailValidation` equals `true` it sets the account email status to not validated.

!!! info "**POST**: `/api/auth/email/verify/:id?params`"
- **id**: `uuid`
- **isEmailValidation**: `boolean`
34 changes: 22 additions & 12 deletions docs/pages/stacks.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
# Stacks
# Technologies

![[Node.js](https://nodejs.org/)](https://img.shields.io/badge/Node.js-5FA04E?style=for-the-badge&logo=nodedotjs&logoColor=white)
![[Express.js](https://expressjs.com/)](https://img.shields.io/badge/Express.js-000000?style=for-the-badge&logo=express&logoColor=white)
![[MongoDB](https://www.mongodb.com/)](https://img.shields.io/badge/MongoDB-47A248?style=for-the-badge&logo=mongodb&logoColor=white)
![[TypeScript](https://www.typescriptlang.org/)](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white)
![[Jest](https://jestjs.io/)](https://img.shields.io/badge/Jest-C21325?style=for-the-badge&logo=jest&logoColor=white)
![[JSON Web Tokens](https://jwt.io/)](https://img.shields.io/badge/JSON%20Web%20Tokens-000000?style=for-the-badge&logo=jsonwebtokens&logoColor=white)
![[Swagger](https://swagger.io/)](https://img.shields.io/badge/Swagger-85EA2D?style=for-the-badge&logo=swagger&logoColor=black)
![[Docker](https://www.docker.com/)](https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=docker&logoColor=white)
![[GitHub Actions](https://docs.github.com/en/actions)](https://img.shields.io/badge/GitHub%20Actions-2088FF?style=for-the-badge&logo=githubactions&logoColor=white)
<p align="center">
<img alt="MongoDB" src="https://img.shields.io/badge/MongoDB-47A248?style=for-the-badge&logo=mongodb&logoColor=white">
<img alt="Node.js" src="https://img.shields.io/badge/Node.js-5FA04E?style=for-the-badge&logo=nodedotjs&logoColor=white">
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white">
<img alt="Express.js" src="https://img.shields.io/badge/Express.js-000000?style=for-the-badge&logo=express&logoColor=white">
<img alt="JSON Web Tokens" src="https://img.shields.io/badge/JSON%20Web%20Tokens-000000?style=for-the-badge&logo=jsonwebtokens&logoColor=white">
<img alt="Jest" src="https://img.shields.io/badge/Jest-C21325?style=for-the-badge&logo=jest&logoColor=white">
<img alt="Cypress" src="https://img.shields.io/badge/Cypress-69D3A7?style=for-the-badge&logo=cypress&logoColor=black">
<img alt="Swagger" src="https://img.shields.io/badge/Swagger-85EA2D?style=for-the-badge&logo=swagger&logoColor=black">
<img alt="Docker" src="https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=docker&logoColor=white">
<img alt="GitHub Actions" src="https://img.shields.io/badge/GitHub%20Actions-2088FF?style=for-the-badge&logo=githubactions&logoColor=white">
<img alt="Sentry" src="https://img.shields.io/badge/Sentry-362D59?style=for-the-badge&logo=sentry&logoColor=white">
<img alt="ESLint" src="https://img.shields.io/badge/ESLint-4B32C3?style=for-the-badge&logo=eslint&logoColor=white">
<img alt="SonarCloud" src="https://img.shields.io/badge/Sonar%20Cloud-F3702A?style=for-the-badge&logo=sonarcloud&logoColor=white">
<img alt="Codecov" src="https://img.shields.io/badge/Codecov-F01F7A?style=for-the-badge&logo=codecov&logoColor=white">
</p>

## Project Stacks
## Stacks

* Engine: [Node.js](https://nodejs.org/)
* Framework: [Express.js](https://expressjs.com/)
* Database: [MongoDB](https://www.mongodb.com/)
* Language: [TypeScript](https://www.typescriptlang.org/)
* Testing: [Jest](https://jestjs.io/)
* Testing: [Jest](https://jestjs.io/), [Cypress](https://www.cypress.io/)
* Security: [JSON Web Tokens](https://jwt.io/)
* Documentation: [Swagger](https://swagger.io/)
* Containerization: [Docker](https://www.docker.com/)
* CI/CD: [GitHub Actions](https://docs.github.com/en/actions)
* Self-host using: [Coolify](https://coolify.io/)
* Linter: [ESLint](https://eslint.org/)
* Tracing: [Sentry](https://sentry.io)
* Code Analysis: [Sonar Cloud](https://sonarcloud.io), [Codecov](https://codecov.io/)

## Design Patterns

Expand Down
18 changes: 16 additions & 2 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"info": {
"title": "Accounts Core API",
"description": "API documentation for the Accounts Core service.",
"version": "0.8.1",
"version": "0.8.2",
"license": {
"name": "AGPL-3.0",
"url": "https://www.gnu.org/licenses/agpl-3.0.html"
},
"contact": {
"name": "Contact-us",
"email": "[email protected]"
}
},
"externalDocs": {
Expand Down Expand Up @@ -71,7 +75,8 @@
"in": "query",
"required": false,
"schema": {
"type": "string"
"type": "string",
"format": "email"
}
}
],
Expand Down Expand Up @@ -307,6 +312,15 @@
"schema": {
"type": "string"
}
},
{
"name": "isEmailValidation",
"in": "query",
"required": false,
"schema": {
"type": "boolean",
"default": false
}
}
],
"responses": {
Expand Down

0 comments on commit 64e35e1

Please sign in to comment.