class Arguments: id = graphene.ID() icon = graphene.Int() time_from = graphene.Time() time_to = graphene.Time() is_active = graphene.Boolean() token = graphene.String(required=True)
class Shop(graphene.ObjectType): id = graphene.UUID() name = graphene.String() latitude = graphene.Float() longitude = graphene.Float() opens_at = graphene.Time() closes_at = graphene.Time()
class Arguments: event_type_id = graphene.String(required=True) start_date = graphene.Date() end_date = graphene.Date(required=True) start_time = graphene.Time() end_time = graphene.Time(required=True) event_title = graphene.String(required=True) description = graphene.String()
class Arguments: id = graphene.Int(required=True) description = graphene.String(required=False) lecturer = graphene.String(required=False) day = graphene.String(required=False) type = graphene.String(required=False) start_time = graphene.Time(required=False) end_time = graphene.Time(required=False) limit = graphene.Int(required=False)
class Arguments: subject_type_id = graphene.Int(required=True, name='subjectTypeId') description = graphene.String(required=True) lecturer = graphene.String(required=True) day = graphene.String(required=True) type = graphene.String(required=True) start_time = graphene.Time(required=True) end_time = graphene.Time(required=True) limit = graphene.Int(required=True)
class Arguments: name = graphene.String() building_id = graphene.ID() icon = graphene.Int() time_from = graphene.Time() time_to = graphene.Time() is_active = graphene.Boolean() devices_states = graphene.List(ScheduleDeviceStateInput) token = graphene.String(required=True)
class Arguments: name = graphene.String(required=True) phone = graphene.String(required=True) from_time = graphene.Time(required=True) to_time = graphene.Time(required=True) line_1 = graphene.String(required=True) line_2 = graphene.String() province = graphene.String(required=True) city = graphene.String(required=True)
class TimeEntryCreateInputType(graphene.InputObjectType): """ Time Entry Create Input Type """ description = graphene.String() date = graphene.Date() start_time = graphene.Time() end_time = graphene.Time() task = graphene.ID(required=True) user = graphene.ID()
class TimeEntryUpdateInputType(graphene.InputObjectType): """ Time Entry Update Input Type """ id = graphene.ID(required=True) date = graphene.Date() start_time = graphene.Time() end_time = graphene.Time() task = graphene.ID() user = graphene.ID()
class Arguments: name = graphene.String(required=True) description = graphene.String() sport_id = graphene.String(required=True) start_date = graphene.Date() end_date = graphene.Date() start_time = graphene.Time() end_time = graphene.Time() minimum_members = graphene.Int(required=True) maximum_members = graphene.Int(required=True) expected_teams = graphene.Int()
class Query(graphene.ObjectType): """定义规则,规范""" hello = graphene.String(name='hi', desc=graphene.String(default_value='jack'), gender=graphene.String(required=True)) int = graphene.Int() float = graphene.Float() boolean = graphene.Boolean() id = graphene.ID() data = graphene.Date() # data(2021.1.2) time = graphene.Time() # time(1,2,3) date_time = graphene.DateTime() # datetime(2021,1,2,3,4,5) decimal = graphene.Decimal() # decimal(10.30) json = graphene.JSONString() def resolve_hello(self, info, desc, gender): """返回结果""" return f"hi GraphQL, desc:{desc}, gender:{gender}" def resolve_data(self, info): """返回结果""" return date(2021, 1, 2) def resolve_time(self, info): """返回结果""" return time(5, 1, 2) def resolve_date_time(self, info): """返回结果""" return datetime(2021, 12, 23, 4, 5, 6) def resolve_decimal(self, info): """返回结果""" return decimal.Decimal("20.23") def resolve_json(self, info): """返回结果""" return {"name": "jack"} info = graphene.String(required=True) def resolve_info(self, info): """返回结果""" return "" nonnull = graphene.NonNull(graphene.String) # 不可返回为空 def resolve_nonnull(self, info): """返回结果""" return None list = graphene.List(graphene.String) # list = graphene.List(graphene.NonNull(graphene.String)) # 不能为空写法一,限制里面的内容 # list = graphene.NonNull(graphene.List(graphene.String)) # 不为空写法二,限制外面的内容 def resolve_list(self, info): """返回结果""" return None
class Arguments: id = graphene.ID(required=True) name = graphene.String(description="The name of the task") category_id = graphene.Int() due_date = graphene.Date( description="The date for which the task is in due") due_time = graphene.Time( description="The time for which the task is in due") completed_date = graphene.Date( description="The date in which the task has been completed.") completed_time = graphene.Time( description="The time in which the project has been completed.") opportunity_id = graphene.Int( description="Assign the task to an opportunity.") status = graphene.Int( description= "The status of a task. 0 for open 1 for working 3 for completed.")
class TaskDetail(graphene.ObjectType): id = graphene.ID(description="The unique id of a task") user_id = graphene.Int( description="The id of an user to which the task has been assigned") name = graphene.String(description="The name of the task.") category_id = graphene.Int( description="The category of the task. Example: Call, Email") due_date = graphene.Date(description="The due date for the task") due_time = graphene.Time(description="The due time for the task") completed_date = graphene.Date( description="The date in which the task has been completed.") completed_time = graphene.Time( description="The time in which the task has been completed.") opportunity_id = graphene.Int(description="This is an optional parameter") status = graphene.Int( description= "The status of the task. 0 -> Not completed; 1-> Working; 2->Completed." )
class Arguments: name = graphene.String(required=True) start_date = graphene.String(required=True) end_date = graphene.String(required=True) days_of_week = graphene.List(graphene.Int, required=True) start_time = graphene.Time(required=True) warmup_durations = graphene.List(graphene.Int) workout_durations = graphene.List(graphene.Int) cooldown_durations = graphene.List(graphene.Int) types = graphene.List(graphene.String) youtubers = graphene.List(graphene.String)
class BuildAdd(graphene.Mutation): machine = graphene.Field(MachineType) date = graphene.Date() timeStart = graphene.Time() timeEnd = graphene.Time() text = graphene.String() comment = graphene.String() build_services = graphene.Field(DeveloperType) posted_by = graphene.Field(UserType) class Arguments: machine_id = graphene.Int() text = graphene.String() service = graphene.String() def mutate(self, info, machine_id, date, time_start, time_end, text, service): user = info.context.user if user.is_anonymous: raise Exception('You must be logged to vote!') machine = Machine.objects.filter(id=machine_id).first() if not machine: raise Exception('Invalid Machine!') event = Build.objects.create( machine=machine, date=date, timeStart=time_start, timeEnd=time_end, text=text, service=service, posted_by=user, ) return BuildAdd( machine=machine, text=text, service=service, posted_by=user, )
class Arguments: scene_id = graphene.Int(required=True) title = graphene.String(required=True) thumbnail_url = graphene.String() preview_url = graphene.String() length = graphene.Time() description = graphene.String() gallary_urls = graphene.String() studio = graphene.String() director = graphene.String() release_date = graphene.Date() movie = graphene.String() rating = graphene.Int()
class Arguments: movie_id = graphene.Int(required=True) movie_title = graphene.String(required=True) movie_cover = graphene.String() movie_trailer = graphene.String() length = graphene.Time() description = graphene.String() gallary_urls = graphene.String() studio = graphene.String() director = graphene.String() release_date = graphene.Date() genres = graphene.String() rating = graphene.Int() tags = graphene.String() performers = graphene.String()
class AttributeTimeInputFields(graphene.InputObjectType): field_id = graphene.Int( required=True, description="The field ID of the attribute", ) value = graphene.Time(description="The value of the attribute", )
class Input: date = graphene.Date(required=True) #ISO 8601 start = graphene.Time(required=True) end = graphene.Time(required=True)
class Arguments: retro_name = graphene.String(required=True) retro_date = graphene.Date() retro_time = graphene.Time() retro_format = graphene.String(required=True) retro_fk_team = graphene.String(required=True)
class TimeBlockInput(graphene.InputObjectType): name = graphene.String(required=True) start_time = graphene.Time(required=True) end_time = graphene.Time(required=True) days = graphene.String(required=True)
class UpdateRestaurantInput(graphene.InputObjectType): id = graphene.Int(required=True) name = graphene.String() opens_at = graphene.Time() closes_at = graphene.Time()
class RestaurantInput(graphene.InputObjectType): name = graphene.String(required=True) opens_at = graphene.Time(required=True) closes_at = graphene.Time(required=True)
class BusinessAvailabilityInput(graphene.InputObjectType): day_of_week = DayOfWeekEnum(require=True) start_time = graphene.Time(require=True) end_time = graphene.Time(require=True)
class Arguments: id = graphene.ID() instructor_id = graphene.ID(name='instructor') day_of_week = DayOfWeekEnum() start_time = graphene.Time() end_time = graphene.Time()
class InstructorAvailabilityInput(graphene.InputObjectType): id = graphene.ID() instructor_id = graphene.ID(name='instructor') day_of_week = DayOfWeekEnum() start_time = graphene.Time() end_time = graphene.Time()
class Profile(graphene.ObjectType): query_id = graphene.ID() access_points_used = graphene.List(of_type=ProfileAccessPoint) profiling_timestamp = graphene.DateTime() profiling_duration = graphene.Time()