Skip to content

Commit

Permalink
Graphql module (#30)
Browse files Browse the repository at this point in the history
* added graphql module

* added graphql module

Co-authored-by: Konstantin Metto <[email protected]>
  • Loading branch information
kmetto and Konstantin Metto authored Jun 21, 2022
1 parent 4c9a158 commit 6d2ae35
Show file tree
Hide file tree
Showing 4 changed files with 227 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
.dcignore
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
- [Assignment](assignments/remote-control/assignment.md)
- [Scoring](assignments/remote-control/score.md)

## GraphQL service
- [Assignment](assignments/graphql-service/assignment.md)
- [Scoring](assignments/graphql-service/score.md)

## REST Service: Basic
- [Assignment](assignments/rest-service/assignment.md)
- [Scoring](assignments/rest-service/score.md)
Expand Down
200 changes: 200 additions & 0 deletions assignments/graphql-service/assignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
# Assignment: Graphql Service

## Description

Imagine we have a couple of microservices that is created for the service Musicify, a new wikipedia for Music. We need to provide a confortable and convinient service for our users for managing and retrieving data for different entities.

The following entities exists:

```typescript
interface Artist {
_id: string;
firstName: string;
secondName: string;
middleName: string;
birthDate: string;
birthPlace: string;
deathDate: string;
deathPlace: string;
country: string;
bandsIds: string[]
instruments: string[];
pseudonims: string[]
labels: string[];
}
```

```typescript
interface User {
_id: string;
firstName: string;
secondName: string;
middleName: string;
password: string;
email: string;
}
```

```typescript
interface Band {
_id: string;
name: string;
origin: string;
yearsActive: string[];
labels: string[];
membersIds: string[];
pastMembers: string;
website: string;
genresIds: string[];
logo: string;
}
```

```typescript
interface Genre {
_id: string;
name: string;
description: string;
country: string;
year: string;
subGenresIds: string[];
}
```

```typescript
interface Track {
_id: string;
artists: Artist[];
bands: Band[];
year: number;
albumId: string;
name: string;
description: string;
lyrics: string;
length: number;
authorsIds: number;
}
```


**Details:**

1. For each entity there is a separate microservice, you can find all microservices in corresponding repositories:

- Artists service
- Users service
- Bands service
- Genres service
- Tracks service
- Favourites service

The instruction how to launch it you can find in service readme.md.

2. The Following types should be created:

```graphql
type Artist {
id: ID!
firstName: String
secondName: String
middleName: String
birthDate: String
birthPlace: String
deathDate: String
deathPlace: String
country: String
bands: String
instruments: String
pseudonims: String
labels: String
}

```
```graphql
type Artist {
id: ID!
name: String
origin: String
yearsActive: String
labels: String
members: [Member]
pastMembers: String
website: String
genres: String
logo: String
}

```
```graphql
type Genre {
id: ID!
name: String
description: String
country: String
year: Int
subGenres: [Genre]
}

```

type Favourites {
id: ID!
name: String
description: String
country: String
year: Int
subGenres: [Genre]
}

3. The following queries ahould be created:

- artist
- artists
- genre
- genres
- track
- tracks
- band
- bands
- favourites (available only for logged in user)

The following mutation should be created:

- createArtist
- deleteArtist
- updateArtist
- createGenre
- deleteGenre
- updateGenre
- createBand
- deleteBand
- updateBand
- createTrack
- deleteTrack
- updateTrack
- addTrackToFavourites
- addBandToFavourites
- addArtistToFavourites
- addGenreToFavourites

**Mutation requests must be available only for logged in users.**

4. Service port should be configured through env variable.

5. Each entity must have a separate module.

```
- app
-modules
- bands
- artists
- tracks
- genres
- favourites
```
21 changes: 21 additions & 0 deletions assignments/graphql-service/score.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Scoring: Graphql Service

## Basic Scope

- **+20** The repository with the application contains a `Readme.md` file containing detailed instructions for installing, running and using the application
- **+20** The application code that worked with `Users` instance divided into modules according to to its purpose and Nest.js architecture conventions (work with request and response in controller, business logic in service, etc.)
- **+20** The application code that worked with `Tracks` instance instance divided into modules according to to its purpose and Nest.js architecture conventions (work with request and response in controller, business logic in service, etc.)
- **+20** The application code that worked with `Albums` instance instance divided into modules according to to its purpose and Nest.js architecture conventions (work with request and response in controller, business logic in service, etc.)
- **+20** The application code that worked with `Artists` instance instance divided into modules according to to its purpose and Nest.js architecture conventions (work with request and response in controller, business logic in service, etc.)
- **+20** The application code that worked with `Favorites` instance instance divided into modules according to to its purpose and Nest.js architecture conventions (work with request and response in controller, business logic in service, etc.)

## Forfeits

- **-200** Changes in tests
- **-150** Full link to repository differs from https://github.com/%your-gihub-id%/nodejs2022Q2-service
- **-30% of max task score** Commits after deadline (except commits that affect only Readme.md, .gitignore, etc.)
- **-20** No separate development branch
- **-20** No Pull Request
- **-10** Pull Request description is incorrect
- **-10** Every lint error after npm run lint using local config (errors, not warnings)
- **-20** Less than 3 commits in the development branch, not including commits that make changes only to `Readme.md` or similar files (`tsconfig.json`, `.gitignore`, `.prettierrc.json`, etc.)

0 comments on commit 6d2ae35

Please sign in to comment.