Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into feat/new-auth
  • Loading branch information
DhruvDave12 committed Mar 11, 2023
2 parents afbf40a + 9b8c280 commit 5566078
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 53 deletions.
77 changes: 28 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
</p>

[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest

<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->

## Description

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
## Problem

People with disabilities and language barriers often face challenges in conversation. For individuals with disabilities, physical or communication limitations can make it difficult to express themselves effectively. For those with language barriers, they may struggle to understand the conversation or be understood by others. These challenges can lead to feelings of isolation and frustration, as well as misunderstandings and missed opportunities. To address these issues, it is important to create an inclusive and supportive environment where individuals feel comfortable and able to participate fully in conversations. We need assistive technologies to help people in this regards.

## Idea

The idea is to create a mobile application which people can use to conduct their conversations which has voice-to-text, text-to-speech, voice translations and text translations inbuilt to facilitate smoother conversations so that people can actually focus on the conversation instead of worrying about such barriers.

## Benefits

- Promotes inclusivity
- Promotes international events
- Eliminates language barriers
- Promotes healthy conversations

## Tech-stack

The mobile application is made Flutter and uses [socket.io](http://socket.io) to handle messages with the backend which is made using Nest.js, Prisma ORM, GraphQL, Socket.io, MongoDB, Azure Cognitive Language service and deployed on Azure.

## Future Work:

This can be extended to one to many or many to many conversations like speeches, online chatting, live events like workshops and events with people with multiple nationalities. This will give more chance for people with disablities to attend such events without fear. They can pay more attention to the actual content of discussions instead of worrying about their disablities in understanding, conveying and be themselves and proudly take part in coversations.

## Installation

Expand All @@ -41,30 +36,14 @@ $ yarn run dev
# production mode
$ yarn run start:prod
```
## Postman Workspace

## Test

```bash
# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov
```

## Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
[Workspace Link](https://www.canva.com/design/DAFZrVf9stg/6lTLJV1MHiz_9YX7VvpCqQ/view?utm_content=DAFZrVf9stg&utm_campaign=designshare&utm_medium=link2&utm_source=sharebutton)

## Stay in touch
## Azure Deployment

- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)
[GraphQL Explorer](https://relay-backend.azurewebsites.net/graphql)

## License
## Presentation

Nest is [MIT licensed](LICENSE).
[Canva Presentation](https://www.canva.com/design/DAFZrVf9stg/6lTLJV1MHiz_9YX7VvpCqQ/view?utm_content=DAFZrVf9stg&utm_campaign=designshare&utm_medium=link2&utm_source=sharebutton)
7 changes: 7 additions & 0 deletions graphql/settings.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
input UpdateLanguageInput {
lang: String!
}

type Mutation {
updateLanguage(input: UpdateLanguageInput!): String!
}
2 changes: 2 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { PrismaService } from 'prisma/prisma.service';
import { TranslateModule } from './translate/translate.module';
import { TranslateSocketModule } from './translate-socket/translate.event';
import { RadarModule } from './radar/radar.module';
import { SettingsModule } from './settings/settings.module';
@Module({
imports: [
GraphQLModule.forRoot<ApolloDriverConfig>({
Expand All @@ -24,6 +25,7 @@ import { RadarModule } from './radar/radar.module';
TranslateModule,
TranslateSocketModule,
RadarModule,
SettingsModule,
],
controllers: [AppController],
providers: [AppService, PrismaService],
Expand Down
14 changes: 10 additions & 4 deletions src/graphql.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
/* tslint:disable */
/* eslint-disable */

export class UpdateLanguageInput {
lang: string;
}

export class TranslateInput {
text: string;
source: string;
Expand Down Expand Up @@ -40,6 +44,12 @@ export abstract class IQuery {
abstract getUser(): User | Promise<User>;
}

export abstract class IMutation {
abstract updateLanguage(input: UpdateLanguageInput): string | Promise<string>;

abstract login(input: SignupInput): string | Promise<string>;
}

export class User {
id: string;
name: string;
Expand All @@ -50,9 +60,5 @@ export class User {
updatedAt: DateTime;
}

export abstract class IMutation {
abstract login(input: SignupInput): string | Promise<string>;
}

export type DateTime = any;
type Nullable<T> = T | null;
9 changes: 9 additions & 0 deletions src/settings/settings.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { SettingsService } from './settings.service';
import { SettingsResolver } from './settings.resolver';
import { PrismaService } from 'prisma/prisma.service';

@Module({
providers: [SettingsResolver, SettingsService, PrismaService],
})
export class SettingsModule {}
25 changes: 25 additions & 0 deletions src/settings/settings.resolver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { BadRequestException } from '@nestjs/common';
import { Args, Context, Mutation, Resolver } from '@nestjs/graphql';
import { PrismaService } from 'prisma/prisma.service';
import { UpdateLanguageInput } from 'src/graphql.types';
import { verifyJWT } from 'src/utils/jwt.utils';
import { SettingsService } from './settings.service';

@Resolver()
export class SettingsResolver {
constructor(
private readonly settingsService: SettingsService,
private readonly prismaService: PrismaService,
) {}
@Mutation('updateLanguage')
async updateLanguage(
@Args('input') input: UpdateLanguageInput,
@Context() ctx,
) {
const { payload, expired } = verifyJWT(
ctx.req.headers.authorization?.split(' ')[1],
);
if (expired) throw new BadRequestException('Token expired');
return await this.settingsService.updateLanguage(payload.id, input.lang);
}
}
15 changes: 15 additions & 0 deletions src/settings/settings.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Injectable } from '@nestjs/common';
import { PrismaService } from 'prisma/prisma.service';

@Injectable()
export class SettingsService {
constructor(private readonly prismaService: PrismaService) {}

async updateLanguage(userId: string, language: string) {
await this.prismaService.user.update({
where: { id: userId },
data: { language },
});
return 'Successfully updated language';
}
}

0 comments on commit 5566078

Please sign in to comment.