A progressive Node.js API for Star Citizen to track the market with the help of the community.
8 | 9 | ## Frontend 10 | 11 | - Repository 12 | - Website 13 | 14 | ## Discord 15 | 16 | [](https://discord.gg/FxJmUYT) 17 | 18 | ## Why dont you use VerseMate? 19 | 20 | I really like VerseMate! 21 | However, there are a few things that VerseMate (currently) does not support 22 | 23 | This API and the associated frontend has the following advantages: 24 | 25 | - Community-based _the data is not read from the game_ 26 | - API _frontend is completely decoupled from the API_ 27 | - Open Source _everyone can contribute_ 28 | - You can provide item prices to your main organization or make them available to all your organizations 29 | 30 | ## Installation 31 | 32 | ```bash 33 | $ yarn 34 | ``` 35 | 36 | ## Init database 37 | 38 | ```bash 39 | $ yarn migrate up 40 | ``` 41 | 42 | ## Running the app 43 | 44 | ```bash 45 | # development 46 | $ yarn start 47 | 48 | # watch mode 49 | $ yarn start:dev 50 | 51 | # incremental rebuild (webpack) 52 | $ yarn webpack 53 | $ yarn start:hmr 54 | 55 | # production mode 56 | $ yarn start:prod 57 | ``` 58 | 59 | ## Test 60 | 61 | ```bash 62 | # unit tests 63 | $ yarn test 64 | 65 | # e2e tests 66 | $ yarn test:e2e 67 | 68 | # test coverage 69 | $ yarn test:cov 70 | ``` 71 | 72 | ## Local setup with docker 73 | 74 | ```bash 75 | $ docker network create sctm-net 76 | $ docker-compose up 77 | ``` 78 | 79 | Now you can connect into the database via pgadmin localhost:5433 80 | Also you can fetch the api via localhost:3000/graphql 81 | 82 | ### Docker Cleanup 83 | 84 | ```bash 85 | $ docker rm SCTM_API 86 | $ docker rmi star-citizen-trade-market-api_sctm-api 87 | $ docker rm SCTM_PostgreSQL 88 | ``` 89 | 90 | ## License 91 | 92 | [MIT licensed](LICENSE) 93 | -------------------------------------------------------------------------------- /src/commodity-category/commodity-category.resolvers.ts: -------------------------------------------------------------------------------- 1 | import { UseGuards } from '@nestjs/common'; 2 | import { Args, Mutation, Query, Resolver, Subscription } from '@nestjs/graphql'; 3 | import { PubSub } from 'graphql-subscriptions'; 4 | import { GraphqlAuthGuard } from '../auth/graphql-auth.guard'; 5 | import { HasAnyRole } from '../auth/has-any-role.decorator'; 6 | import { RoleGuard } from '../auth/role.guard'; 7 | import { CommodityCategory, Role } from '../graphql.schema'; 8 | import { CommodityCategoryService } from './commodity-category.service'; 9 | import { CreateCommodityCategoryDto } from './dto/create-commodity-category.dto'; 10 | 11 | const pubSub: PubSub = new PubSub(); 12 | 13 | @Resolver('CommodityCategory') 14 | export class CommodityCategoryResolvers { 15 | public constructor(private readonly commodityCategoryService: CommodityCategoryService) {} 16 | 17 | @Query() 18 | public async commodityCategories(): Promise