Skip to content

Commit

Permalink
feat: quote module (#63)
Browse files Browse the repository at this point in the history
* docs: added quote endpoint specification

* refactor: scroll behavior

* feat: added boilerplate for module

* feat: add endpoint for creating quote

* feat: added get random quote

* feat: added get all quote

* feat: added update/delete endpoint for quotes

* docs: updated workspae

* docs: added quote in doc webiste

* chore(release): 1.10.0
  • Loading branch information
KostaD02 authored Sep 30, 2023
1 parent e9c9cf7 commit 38d0642
Show file tree
Hide file tree
Showing 26 changed files with 888 additions and 265 deletions.
78 changes: 78 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,84 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## 1.10.0 (2023-09-30)


### Features

* add dto validation for shop and user ([#7](https://github.com/educata/everrest/issues/7)) ([cc53c0b](https://github.com/educata/everrest/commit/cc53c0b1cc566442749d031696feb73a9d869e79))
* add dummy phones data ([5cc77b5](https://github.com/educata/everrest/commit/5cc77b54da5cf8e7d778d7cf63269af816a271f4))
* add endpoint for creating quote ([a82f609](https://github.com/educata/everrest/commit/a82f609fe85f6013e7eed102a37946920f9ead4a))
* add exceptions handling ([929360d](https://github.com/educata/everrest/commit/929360d7fb5725064fab3b5234734848a023da8b))
* add full support for swagger ([#12](https://github.com/educata/everrest/issues/12)) ([c88d1bb](https://github.com/educata/everrest/commit/c88d1bb02881b0803f26cebdfb15cbf724706f53))
* add initial swagger docs ([#8](https://github.com/educata/everrest/issues/8)) ([ba54833](https://github.com/educata/everrest/commit/ba54833dc72a4df52a3caff08216c11637d77de9))
* add logo ([5cf915d](https://github.com/educata/everrest/commit/5cf915d99e3d80a7a66d7b42c1c6ea717c139ccb))
* add mongoose id validation service and custom decorator ([7285507](https://github.com/educata/everrest/commit/7285507d4f06ded2e002d8159b2201420ee75365))
* add mongoose id validation service and decorator ([b00a60b](https://github.com/educata/everrest/commit/b00a60bd1a68221ca8d44dd11dba07f19098f2eb))
* add products modules ([691381b](https://github.com/educata/everrest/commit/691381bc2e0aaa41263966a4ad1fe906fb8586c8))
* added boilerplate for module ([b713199](https://github.com/educata/everrest/commit/b71319987095b33dc4b5fb48fae3b920561f6513))
* added get all quote ([85e031c](https://github.com/educata/everrest/commit/85e031ce5c37b7a857b2697c93f753dc62d55012))
* added get random quote ([ef8fa85](https://github.com/educata/everrest/commit/ef8fa85e344004114d1253d4ddbad04e98be00bd))
* added insomnia work environment ([#11](https://github.com/educata/everrest/issues/11)) ([50283b4](https://github.com/educata/everrest/commit/50283b4d9ac4d448d5b7cfc8bd6db93183458679))
* added product uploader page and fixed cors for any origin ([#24](https://github.com/educata/everrest/issues/24)) ([bbc778f](https://github.com/educata/everrest/commit/bbc778f1e45b795648e0d88e5aba9b5a7a6d7bfa))
* added role based guard and refactored shared folder ([#9](https://github.com/educata/everrest/issues/9)) ([57cb224](https://github.com/educata/everrest/commit/57cb224e8a3bb8ad1a3cfcec1559ae6d76bd0cc5))
* added update/delete endpoint for quotes ([3b79b71](https://github.com/educata/everrest/commit/3b79b71fe4b5c1d04eb1ddce8a39a9735a740a6d))
* added user/cart/products interfaces and dummy data ([c741fc9](https://github.com/educata/everrest/commit/c741fc9022a1f46cb0cdfce9967df36b041b98b3))
* allow cors from any origin, WIP solution ([#23](https://github.com/educata/everrest/issues/23)) ([0283e7d](https://github.com/educata/everrest/commit/0283e7d2d4e8b3d49602021474ea64333da25c7e))
* **auth:** create user schema and base controller/service ([b3b42db](https://github.com/educata/everrest/commit/b3b42db24ff67a2dc2a151c07d4fd6e538205c83))
* **cart:** add checkout endpoint ([57e33bc](https://github.com/educata/everrest/commit/57e33bc07ef28c03bcad4dd6f4307b0fd1a7e8fa))
* **cart:** added boilerplate for cart service/controller ([a1c2eb2](https://github.com/educata/everrest/commit/a1c2eb2cbf44fb3d28954510fe94efc8009ef139))
* **cart:** added cart schema ([bea9143](https://github.com/educata/everrest/commit/bea9143522f970558ed03755649484a9463e02dc))
* **cart:** added clear cart endpoint ([f06774b](https://github.com/educata/everrest/commit/f06774bc3868d78410963735a1eff422f1765362))
* **cart:** added delete endpoint for single cart item ([62b1c16](https://github.com/educata/everrest/commit/62b1c162bdd5c0dca68b9247191212aecaa0399a))
* **cart:** added functional to get cart and init cart ([c91a006](https://github.com/educata/everrest/commit/c91a0069a38b64b341c04945fbf5bb8e9e9b4f17))
* **cart:** added updateCart ([b4ec443](https://github.com/educata/everrest/commit/b4ec44323cabc665d5a541a48c3ed1270f76adad))
* **cart:** added validation if quantity is more than stock ([c13f39a](https://github.com/educata/everrest/commit/c13f39a7084dc4b4503965c46d806730976dc91d))
* Create LICENSE ([#22](https://github.com/educata/everrest/issues/22)) ([2e9b2c6](https://github.com/educata/everrest/commit/2e9b2c6e7d04d48ac6349ee6303bc09c18a64dd7))
* error-response update ([#62](https://github.com/educata/everrest/issues/62)) ([e9c9cf7](https://github.com/educata/everrest/commit/e9c9cf7f17cb5a35ce7aae8c72ab55e26e10b15d))
* internationalization ([#21](https://github.com/educata/everrest/issues/21)) ([fb16566](https://github.com/educata/everrest/commit/fb16566ed1f4a4fe94ea3f55907ab225ae8ce402))
* modified error handling with new catch error, added some dto and enums ([7763ac6](https://github.com/educata/everrest/commit/7763ac65ea1acf8d712309cda07c4df691f61994))
* **qrcode:** added qrcode generator endpoints with text/images ([#33](https://github.com/educata/everrest/issues/33)) ([9b8cef4](https://github.com/educata/everrest/commit/9b8cef48692c77f54a8be0e9414108d8ec0dafbe))
* **shared:** added custom decorator to decode jwt data ([af2331f](https://github.com/educata/everrest/commit/af2331fd02646efdda182288e239b4ea8f78d2cf))
* **shop:** add getProductById and updateProduct endpoints ([3eb62b9](https://github.com/educata/everrest/commit/3eb62b999a5ffc4873739a760e0c7f21c4916db1))
* **shop:** add pagination to some endpoints ([3c76eda](https://github.com/educata/everrest/commit/3c76eda482ca7f44d6aec2ed32d7cbc952e7615f))
* **shop:** add some data with modified get all endpoint ([22c16e4](https://github.com/educata/everrest/commit/22c16e473a3dc157a8ff3f7d0a0d4a9972f37d22))
* **shop:** added delete endpoint ([e26f64a](https://github.com/educata/everrest/commit/e26f64a4ef33e8d67cbb973534ae4cffbdc0f3b9))
* **shop:** added pagination to all product endpoint ([210ceab](https://github.com/educata/everrest/commit/210ceabb68c053ed8825dac8b1976489ef061812))
* **shop:** added search endpoint ([84e4ae8](https://github.com/educata/everrest/commit/84e4ae84ab8df26ffc7bb3f4142b24184b3194e2))
* **shop:** added search endpoint with pagination ([d10b34d](https://github.com/educata/everrest/commit/d10b34d501745576204800b56e5c75017c42817a))
* **shop:** added updateProductRating endpoint ([90c7251](https://github.com/educata/everrest/commit/90c725164c7bcffc9cba8f13bf7853db6f3cccee))
* **shop:** exclude ratings from products response ([62673cf](https://github.com/educata/everrest/commit/62673cf5d577ba524b3d9dbbe934a56d0b4c735b))
* **shop:** mark id params for future middleware implementation ([e751dea](https://github.com/educata/everrest/commit/e751deac9023b280f28413e3b7f88fa6b4655967))
* **shop:** mark new rating feature for future implementation ([b254b6f](https://github.com/educata/everrest/commit/b254b6f1145482a88f668744153ab68e64da8fc7))
* **user:** add sign up endpoint ([415b335](https://github.com/educata/everrest/commit/415b3356899c04b4daf9bd62dd222c4593c67124))
* **user:** added user endpoints ([#5](https://github.com/educata/everrest/issues/5)) ([10c9fb9](https://github.com/educata/everrest/commit/10c9fb96216801deea41b515e5c8920d4d505b36))
* **user:** new user endpoints ([#18](https://github.com/educata/everrest/issues/18)) ([ac8a5a0](https://github.com/educata/everrest/commit/ac8a5a0b8e971bd2227e5dff18c2a1dde709b358))
* **user:** updated jwt guard ([#6](https://github.com/educata/everrest/issues/6)) ([c7b949c](https://github.com/educata/everrest/commit/c7b949c8e53b55c8cb34486120b1799b2ebf332f))
* **user:** WIP user jwt auth ([b32aa8d](https://github.com/educata/everrest/commit/b32aa8dca2cbce729bd5fd0bce8414a65f1234c1))


### Bug Fixes

* auth endpoint ([#52](https://github.com/educata/everrest/issues/52)) ([192bd4f](https://github.com/educata/everrest/commit/192bd4ffa5e003964fd018b718f566ca332475d4))
* **auth:** added sameSite attribute ([#25](https://github.com/educata/everrest/issues/25)) ([d1ef296](https://github.com/educata/everrest/commit/d1ef296a030e016737fcd9b04ddb53e8d88c2797))
* **auth:** process env reading in other module & refactored jwt guard ([3b57162](https://github.com/educata/everrest/commit/3b571620bdeb38a744f21c839be5a86e069a744c))
* **cart:** fixed total object values ([5de7f43](https://github.com/educata/everrest/commit/5de7f4395d5ecccba4d52f84e4a59b4ff538b2db))
* **cart:** handled beforeDiscount price ([102ec87](https://github.com/educata/everrest/commit/102ec87576dd6363957ad41808f8cae4a36e4ee1))
* failing documentation build ([#42](https://github.com/educata/everrest/issues/42)) ([4703adc](https://github.com/educata/everrest/commit/4703adc35ed62750a72eeb96dea2ff8965ffa5cd))
* file name typo ([168299e](https://github.com/educata/everrest/commit/168299ee890427fe989112c73280b84f059341d9))
* handling os commands differently for windows and linux ([#37](https://github.com/educata/everrest/issues/37)) ([e85670c](https://github.com/educata/everrest/commit/e85670c949318102c1ff70a03eb828b1029c784c))
* heroku using wrong deploy script ([#19](https://github.com/educata/everrest/issues/19)) ([0909911](https://github.com/educata/everrest/commit/09099115e9f21e56188c97fa17b1fe20fd06e494))
* **products:** categories using name ([e7fed08](https://github.com/educata/everrest/commit/e7fed0899cfe08889ffc26fdcdf20269dff1e2fc))
* **products:** isNumber validator causing error ([#26](https://github.com/educata/everrest/issues/26)) ([6ea7307](https://github.com/educata/everrest/commit/6ea7307f3e343596655477737c983ce60c0a9f7d))
* **products:** modified product builder & cookie samesite ([#27](https://github.com/educata/everrest/issues/27)) ([f674bff](https://github.com/educata/everrest/commit/f674bff8c91bf2f03bf94e5e02110920d79edcf3))
* serialize user at update ([#53](https://github.com/educata/everrest/issues/53)) ([953c711](https://github.com/educata/everrest/commit/953c7111df4f419618dbbbeae947d15caba17ee9))
* **shop:** add handle for search case (min,max) ([d46ce7f](https://github.com/educata/everrest/commit/d46ce7fe0bb9800cbf9444ae95489314d755d0d4))
* **shop:** getCategoryById and getCategories endpoints ([874d3f8](https://github.com/educata/everrest/commit/874d3f83f10a00835987f4427c14aa71faee8a7b))
* todos and implemented title check ([#40](https://github.com/educata/everrest/issues/40)) ([6e18590](https://github.com/educata/everrest/commit/6e185907b681fdc1312aa7752398ed3ee76ed458))
* **user:** correct user interface and added user schema ([8072894](https://github.com/educata/everrest/commit/807289409ce393c7fa892d141773f3845adef4e9))
* wrong heroku worker name ([#43](https://github.com/educata/everrest/issues/43)) ([8280721](https://github.com/educata/everrest/commit/8280721bc849c64499b1eeff7b23164d1781ee51))

## 1.9.0 (2023-09-27)


Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default defineConfig({
title: 'EverREST',
description: 'Build real CRUD applications with EverREST API',
lang: 'en-US',
head: [...Metadata, ['style', {}, 'html { scroll-behavior: smooth; }']],
head: [...Metadata, ['style', {}, 'html { scroll-behavior: smooth; @media (prefers-reduced-motion) { html { scroll-behavior: initial; } }']],
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
Expand All @@ -29,6 +29,7 @@ export default defineConfig({
],
},
{ text: 'QR', link: '/qr' },
{ text: 'Quote', link: '/quote'},
{ text: 'Errors', link: '/errors' },
{ text: 'Team Members', link: '/team' },
],
Expand Down
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ features:
details: Generate a QR code with or without image
icon: <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><path d="M0 80C0 53.5 21.5 32 48 32h96c26.5 0 48 21.5 48 48v96c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80zM64 96v64h64V96H64zM0 336c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v96c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V336zm64 16v64h64V352H64zM304 32h96c26.5 0 48 21.5 48 48v96c0 26.5-21.5 48-48 48H304c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48zm80 64H320v64h64V96zM256 304c0-8.8 7.2-16 16-16h64c8.8 0 16 7.2 16 16s7.2 16 16 16h32c8.8 0 16-7.2 16-16s7.2-16 16-16s16 7.2 16 16v96c0 8.8-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s-7.2-16-16-16s-16 7.2-16 16v64c0 8.8-7.2 16-16 16H272c-8.8 0-16-7.2-16-16V304zM368 480a16 16 0 1 1 0-32 16 16 0 1 1 0 32zm64 0a16 16 0 1 1 0-32 16 16 0 1 1 0 32z" /></svg>
link: /qr
- title: Quote
details: Get quotes from games, movies, series, and general topics
icon: <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><path d="M0 216C0 149.7 53.7 96 120 96h8c17.7 0 32 14.3 32 32s-14.3 32-32 32h-8c-30.9 0-56 25.1-56 56v8h64c35.3 0 64 28.7 64 64v64c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V320 288 216zm256 0c0-66.3 53.7-120 120-120h8c17.7 0 32 14.3 32 32s-14.3 32-32 32h-8c-30.9 0-56 25.1-56 56v8h64c35.3 0 64 28.7 64 64v64c0 35.3-28.7 64-64 64H320c-35.3 0-64-28.7-64-64V320 288 216z" /></svg>
link: /quote
- title: Chat
details: Coming soon...
icon: 🗨️
Expand Down
3 changes: 3 additions & 0 deletions docs/quote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Quote

Coming soon...
12 changes: 11 additions & 1 deletion endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,14 @@ prefix - /`qrcode`

- `GET` qrcode
- `POST` qrcode/generate
- `POST` qrcode/generate_with_image
- `POST` qrcode/generate_with_image

## Quote

prefix - /`quote`

- `GET` quote?q (author/keyword)
- `GET` quote/random (1)
- `POST` quote { quote, author }
- `PATCH` quote/id { quote, author }
- `DELETE` quote/id
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "everrest",
"version": "1.9.0",
"version": "1.10.0",
"description": "EverREST backend service for educational purposes",
"author": "Educata Authors",
"private": true,
Expand Down
2 changes: 2 additions & 0 deletions src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ProductExceptionKeys,
ExceptionStatusKeys,
QRCodeExpectionKeys,
QuoteExpectionKeys,
} from 'src/enums';

@ApiTags('root')
Expand All @@ -27,6 +28,7 @@ export class AppController {
...AuthExpectionKeys,
...CartExpectionKeys,
...QRCodeExpectionKeys,
...QuoteExpectionKeys,
});
}
}
2 changes: 2 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ShopModule, UserModule, MailModule, QrCodeModule } from './modules';
import { ExceptionService, EncryptionService } from './shared';
import { QuoteModule } from './modules/quote';
@Module({
imports: [
ConfigModule.forRoot(),
Expand All @@ -14,6 +15,7 @@ import { ExceptionService, EncryptionService } from './shared';
UserModule,
MailModule,
QrCodeModule,
QuoteModule,
],
controllers: [AppController],
providers: [AppService, ExceptionService, EncryptionService],
Expand Down
9 changes: 9 additions & 0 deletions src/enums/exceptions.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,12 @@ export enum QRCodeExpectionKeys {
TextShouldNotBeEmpty = 'errors.text_should_not_be_empty',
ImageUrlShouldNotBeEmpty = 'errors.image_url_should_not_be_empty',
}

export enum QuoteExpectionKeys {
AuthorNameShouldBeString = 'errors.author_name_should_be_string',
QuoteShouldBeString = 'errors.quote_should_be_string',
DuplicatedQuote = 'errors.duplicated_quote',
QuoteKeywordShouldBeString = 'errors.quote_keyword_should_be_string',
QuoteNotFound = 'errors.quote_not_found',
QuoteShouldHaveNewData = 'errors.quote_should_have_new_data',
}
13 changes: 13 additions & 0 deletions src/modules/quote/dtos/all-quote.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { IsOptional, IsString } from 'class-validator';
import { QuoteExpectionKeys } from 'src/enums';
import { PaginationQueryDto } from 'src/shared';

export class AllQuoteDto extends PaginationQueryDto {
@IsOptional()
@IsString({ message: QuoteExpectionKeys.AuthorNameShouldBeString })
author: string;

@IsOptional()
@IsString({ message: QuoteExpectionKeys.QuoteKeywordShouldBeString })
keywords: string;
}
3 changes: 3 additions & 0 deletions src/modules/quote/dtos/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './quote.dto';
export * from './all-quote.dto';
export * from './update-quote.dto';
10 changes: 10 additions & 0 deletions src/modules/quote/dtos/quote.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IsString } from 'class-validator';
import { QuoteExpectionKeys } from 'src/enums';

export class QuoteDto {
@IsString({ message: QuoteExpectionKeys.AuthorNameShouldBeString })
author: string;

@IsString({ message: QuoteExpectionKeys.QuoteShouldBeString })
quote: string;
}
12 changes: 12 additions & 0 deletions src/modules/quote/dtos/update-quote.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { IsOptional, IsString } from 'class-validator';
import { QuoteExpectionKeys } from 'src/enums';

export class UpdateQuoteDto {
@IsOptional()
@IsString({ message: QuoteExpectionKeys.AuthorNameShouldBeString })
author: string;

@IsOptional()
@IsString({ message: QuoteExpectionKeys.QuoteShouldBeString })
quote: string;
}
4 changes: 4 additions & 0 deletions src/modules/quote/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './dtos';
export * from './quote.controller';
export * from './quote.module';
export * from './quote.service';
63 changes: 63 additions & 0 deletions src/modules/quote/quote.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import {
Body,
Controller,
Delete,
Get,
Param,
Patch,
Post,
Query,
UseGuards,
} from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { UserRole } from 'src/enums';
import {
JwtGuard,
MongooseValidatorService,
Roles,
RolesGuard,
} from 'src/shared';
import { QuoteService } from './quote.service';
import { QuoteDto, AllQuoteDto, UpdateQuoteDto } from './dtos';

@ApiTags('quote')
@Controller('quote')
export class QuoteController {
constructor(
private quoteService: QuoteService,
private readonly mongooseValidator: MongooseValidatorService,
) {}

@Get()
getAllQuote(@Query() query: AllQuoteDto) {
return this.quoteService.getAllQuote(query);
}

@Get('random')
getRandomQuote() {
return this.quoteService.getRandomQuote();
}

@Post()
@UseGuards(JwtGuard, RolesGuard)
@Roles(UserRole.Admin)
addQuote(@Body() body: QuoteDto) {
return this.quoteService.addQuote(body);
}

@Patch('id/:id')
@UseGuards(JwtGuard, RolesGuard)
@Roles(UserRole.Admin)
updateQuote(@Param('id') id: string, @Body() body: UpdateQuoteDto) {
this.mongooseValidator.isValidObjectId(id);
return this.quoteService.updateQuoteById(id, body);
}

@Delete('id/:id')
@UseGuards(JwtGuard, RolesGuard)
@Roles(UserRole.Admin)
deleteQuote(@Param('id') id: string) {
this.mongooseValidator.isValidObjectId(id);
return this.quoteService.deleteQuoteById(id);
}
}
25 changes: 25 additions & 0 deletions src/modules/quote/quote.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { ConfigModule } from '@nestjs/config';
import { JwtModule } from '@nestjs/jwt';
import { Quote, QuoteSchema, User, UserSchema } from 'src/schemas';
import { QuoteService } from './quote.service';
import { QuoteController } from './quote.controller';
import { ExceptionService, MongooseValidatorService } from 'src/shared';

@Module({
imports: [
ConfigModule.forRoot(),
MongooseModule.forFeature([
{ name: Quote.name, schema: QuoteSchema },
{ name: User.name, schema: UserSchema },
]),
JwtModule.register({
secret: `${process.env.JWT_SECRET}`,
signOptions: { expiresIn: `${process.env.JWT_EXPIRES_IN || '1'}h` },
}),
],
providers: [QuoteService, ExceptionService, MongooseValidatorService],
controllers: [QuoteController],
})
export class QuoteModule {}
Loading

0 comments on commit 38d0642

Please sign in to comment.