-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore #157693451] fix flake8 failing test
- refactor files to adhere to flake8 specifications
- Loading branch information
Showing
31 changed files
with
249 additions
and
278 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
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,24 +1,25 @@ | ||
import graphene | ||
from graphene import Schema | ||
from graphene_sqlalchemy import SQLAlchemyObjectType | ||
from api.block.models import Block as BlockModel | ||
|
||
|
||
class Block(SQLAlchemyObjectType): | ||
class Meta: | ||
model = BlockModel | ||
|
||
|
||
class Query(graphene.ObjectType): | ||
floor = graphene.List(Block) | ||
get_rooms_in_a_block = graphene.List( | ||
lambda:Block, | ||
block_id = graphene.Int() | ||
lambda: Block, | ||
block_id=graphene.Int() | ||
) | ||
|
||
def resolve_blocks(self,info): | ||
def resolve_blocks(self, info): | ||
query = Block.get_query(info) | ||
return query.all() | ||
|
||
def resolve_get_rooms_in_a_block(self,info,block_id): | ||
def resolve_get_rooms_in_a_block(self, info, block_id): | ||
query = Block.get_query(info) | ||
result = query.filter(BlockModel.id == block_id) | ||
return result | ||
return result |
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
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,17 +1,16 @@ | ||
import graphene | ||
from graphene import Schema | ||
|
||
from graphene_sqlalchemy import SQLAlchemyObjectType | ||
|
||
from api.floor.models import Floor as FloorModel | ||
|
||
|
||
class Floor(SQLAlchemyObjectType): | ||
class Meta: | ||
model = FloorModel | ||
|
||
|
||
class Query(graphene.ObjectType): | ||
floor = graphene.List(Floor) | ||
|
||
def resolve_floors(self,info): | ||
def resolve_floors(self, info): | ||
query = Floor.get_query(info) | ||
return query.all() |
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
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,35 +1,28 @@ | ||
import graphene | ||
from graphene import Schema | ||
from graphene_sqlalchemy import SQLAlchemyObjectType | ||
|
||
from api.location.models import Location as LocationModel | ||
|
||
from api.floor.models import Floor as FloorModel | ||
from api.room.models import Room as RoomModel | ||
from api.room_resource.models import Resource as ResourceModel # noqa: F401 | ||
|
||
from api.room_resource.models import Resource as ResourceModel | ||
|
||
class Location(SQLAlchemyObjectType): | ||
class Meta: | ||
model = LocationModel | ||
|
||
|
||
class Query(graphene.ObjectType): | ||
all_locations = graphene.List(Location) | ||
get_rooms_in_a_location =graphene.List( | ||
lambda:Location, | ||
location_id = graphene.Int() | ||
get_rooms_in_a_location = graphene.List( | ||
lambda: Location, | ||
location_id=graphene.Int() | ||
) | ||
|
||
|
||
def resolve_all_locations(self,info): | ||
def resolve_all_locations(self, info): | ||
query = Location.get_query(info) | ||
return query.all() | ||
|
||
def resolve_get_rooms_in_a_location(self,info,location_id): | ||
query =Location.get_query(info) | ||
def resolve_get_rooms_in_a_location(self, info, location_id): | ||
query = Location.get_query(info) | ||
result = query.filter(LocationModel.id == location_id) | ||
return result | ||
|
||
|
||
|
||
|
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
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
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,15 +1,12 @@ | ||
from sqlalchemy import ( | ||
Column, String, Integer, ForeignKey, func, | ||
DateTime, create_engine) | ||
from sqlalchemy.orm import relationship | ||
|
||
Column, String, Integer, ForeignKey) | ||
from helpers.database import Base | ||
from utilities.utility import Utility | ||
from api.room.models import Room | ||
from api.room.models import Room # noqa: F401 | ||
|
||
|
||
class Resource(Base, Utility): | ||
__tablename__ = 'resources' | ||
id = Column(Integer, primary_key=True) | ||
name = Column(String, nullable=False) | ||
room_id = Column(Integer, ForeignKey('rooms.id')) | ||
room_id = Column(Integer, ForeignKey('rooms.id')) |
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,18 +1,13 @@ | ||
import graphene | ||
|
||
|
||
from graphene import Schema | ||
from graphene_sqlalchemy import (SQLAlchemyObjectType, | ||
SQLAlchemyConnectionField) | ||
from graphene_sqlalchemy import (SQLAlchemyObjectType) | ||
|
||
from api.room_resource.models import Resource as ResourceModel | ||
|
||
|
||
class Resource(SQLAlchemyObjectType): | ||
|
||
class Meta: | ||
model = ResourceModel | ||
|
||
def resolve_Resource(self,info): | ||
def resolve_Resource(self, info): | ||
query = Resource.get_query(info) | ||
return query.all() |
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
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
Oops, something went wrong.