-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# ------------------------------------------------------ | ||
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) | ||
# ------------------------------------------------------ | ||
|
||
"""route""" | ||
type Route { | ||
id: ID! | ||
name: String! | ||
} | ||
|
||
"""platform""" | ||
type Platform { | ||
id: ID! | ||
name: String! | ||
latitude: Float! | ||
longitude: Float! | ||
routes: [Route!]! | ||
} | ||
|
||
"""stop""" | ||
type Stop { | ||
id: ID! | ||
name: String! | ||
avgLatitude: Float! | ||
avgLongitude: Float! | ||
platforms: [Platform!]! | ||
} | ||
|
||
type Query { | ||
"""Get all platforms""" | ||
platform( | ||
""" | ||
if set to `true` returns only metro results, otherwise returns all results (including metro). Defaults to `false`. | ||
""" | ||
metroOnly: Boolean = false | ||
): [Platform!]! | ||
|
||
"""Get all stops""" | ||
stop( | ||
""" | ||
if set to `true` returns only metro results, otherwise returns all results (including metro). Defaults to `false`. | ||
""" | ||
metroOnly: Boolean = false | ||
): [Stop!]! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { Module } from "@nestjs/common"; | ||
|
||
import { PlatformController } from "src/modules/platform/platform.controller"; | ||
import { PlatformResolver } from "src/modules/platform/platform.resolver"; | ||
import { PlatformService } from "src/modules/platform/platform.service"; | ||
|
||
@Module({ | ||
controllers: [PlatformController], | ||
providers: [PlatformService], | ||
providers: [PlatformResolver, PlatformService], | ||
imports: [], | ||
}) | ||
export class PlatformModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Args, Query, Resolver } from "@nestjs/graphql"; | ||
|
||
import { Platform } from "src/models/platform.model"; | ||
import { PlatformService } from "src/modules/platform/platform.service"; | ||
import { metroOnlyQuery } from "src/swagger/query.swagger"; | ||
|
||
@Resolver(() => Platform) | ||
export class PlatformResolver { | ||
constructor(private readonly platformService: PlatformService) {} | ||
|
||
@Query(() => [Platform], { | ||
description: "Get all platforms", | ||
}) | ||
async platform( | ||
@Args("metroOnly", { | ||
description: metroOnlyQuery.description, | ||
defaultValue: false, | ||
nullable: true, | ||
type: () => Boolean, | ||
}) | ||
metroOnly, | ||
): Promise<Platform[]> { | ||
return await this.platformService.getAllPlatforms({ metroOnly }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { Module } from "@nestjs/common"; | ||
|
||
import { StopController } from "src/modules/stop/stop.controller"; | ||
import { StopResolver } from "src/modules/stop/stop.resolver"; | ||
import { StopService } from "src/modules/stop/stop.service"; | ||
|
||
@Module({ | ||
controllers: [StopController], | ||
providers: [StopService], | ||
providers: [StopResolver, StopService], | ||
imports: [], | ||
}) | ||
export class StopModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Args, Query, Resolver } from "@nestjs/graphql"; | ||
|
||
import { Stop } from "src/models/stop.model"; | ||
import { StopService } from "src/modules/stop/stop.service"; | ||
import { metroOnlyQuery } from "src/swagger/query.swagger"; | ||
|
||
@Resolver(() => Stop) | ||
export class StopResolver { | ||
constructor(private readonly stopSerice: StopService) {} | ||
|
||
@Query(() => [Stop], { | ||
description: "Get all stops", | ||
}) | ||
async stop( | ||
@Args("metroOnly", { | ||
description: metroOnlyQuery.description, | ||
defaultValue: false, | ||
nullable: true, | ||
type: () => Boolean, | ||
}) | ||
metroOnly, | ||
): Promise<Stop[]> { | ||
return await this.stopSerice.getAll({ metroOnly }); | ||
} | ||
} |