step 6 : check distance graphql

This commit is contained in:
sindhu
2024-01-22 17:09:02 +07:00
parent ba1f43ae70
commit e9e4d5bf05
7 changed files with 566 additions and 199 deletions

View File

@@ -52,7 +52,7 @@ type ComplexityRoot struct {
}
Query struct {
QueryCheckDistance func(childComplexity int, mStaffID string, mCompanyID string, mCompanyLatitude string, mCompanyLongitude string, currentLatitude string, currentLongitude string) int
QueryCheckDistance func(childComplexity int, mStaffID string, mCompanyID string, currentLatitude string, currentLongitude string) int
SearchStaffByEmail func(childComplexity int, email string) int
StaffGetByStaffID func(childComplexity int, staffID string) int
StaffListBySearch func(childComplexity int, search *string, page *int, maxPerPage *int) int
@@ -60,8 +60,6 @@ type ComplexityRoot struct {
Staff struct {
CompanyID func(childComplexity int) int
CompanyLatitude func(childComplexity int) int
CompanyLongitude func(childComplexity int) int
CompanyName func(childComplexity int) int
CreatedAt func(childComplexity int) int
DisplayNameGoogleSignIn func(childComplexity int) int
@@ -83,6 +81,15 @@ type ComplexityRoot struct {
Token func(childComplexity int) int
}
TransAbsensiCheckDistanceResponse struct {
CurrentDistance func(childComplexity int) int
MaxDistance func(childComplexity int) int
Message func(childComplexity int) int
Selfie func(childComplexity int) int
Status func(childComplexity int) int
Unit func(childComplexity int) int
}
TransAbsensiResponse struct {
Message func(childComplexity int) int
Status func(childComplexity int) int
@@ -97,7 +104,7 @@ type QueryResolver interface {
SearchStaffByEmail(ctx context.Context, email string) (*model.Staff, error)
StaffGetByStaffID(ctx context.Context, staffID string) (*model.Staff, error)
StaffListBySearch(ctx context.Context, search *string, page *int, maxPerPage *int) ([]*model.Staff, error)
QueryCheckDistance(ctx context.Context, mStaffID string, mCompanyID string, mCompanyLatitude string, mCompanyLongitude string, currentLatitude string, currentLongitude string) (*model.TransAbsensiResponse, error)
QueryCheckDistance(ctx context.Context, mStaffID string, mCompanyID string, currentLatitude string, currentLongitude string) (*model.TransAbsensiCheckDistanceResponse, error)
}
type executableSchema struct {
@@ -153,7 +160,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return 0, false
}
return e.complexity.Query.QueryCheckDistance(childComplexity, args["M_StaffID"].(string), args["M_CompanyID"].(string), args["M_CompanyLatitude"].(string), args["M_CompanyLongitude"].(string), args["CurrentLatitude"].(string), args["CurrentLongitude"].(string)), true
return e.complexity.Query.QueryCheckDistance(childComplexity, args["M_StaffID"].(string), args["M_CompanyID"].(string), args["CurrentLatitude"].(string), args["CurrentLongitude"].(string)), true
case "Query.searchStaffByEmail":
if e.complexity.Query.SearchStaffByEmail == nil {
@@ -198,20 +205,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Staff.CompanyID(childComplexity), true
case "Staff.company_latitude":
if e.complexity.Staff.CompanyLatitude == nil {
break
}
return e.complexity.Staff.CompanyLatitude(childComplexity), true
case "Staff.company_longitude":
if e.complexity.Staff.CompanyLongitude == nil {
break
}
return e.complexity.Staff.CompanyLongitude(childComplexity), true
case "Staff.company_name":
if e.complexity.Staff.CompanyName == nil {
break
@@ -324,6 +317,48 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.TokenResponse.Token(childComplexity), true
case "TransAbsensiCheckDistanceResponse.current_distance":
if e.complexity.TransAbsensiCheckDistanceResponse.CurrentDistance == nil {
break
}
return e.complexity.TransAbsensiCheckDistanceResponse.CurrentDistance(childComplexity), true
case "TransAbsensiCheckDistanceResponse.max_distance":
if e.complexity.TransAbsensiCheckDistanceResponse.MaxDistance == nil {
break
}
return e.complexity.TransAbsensiCheckDistanceResponse.MaxDistance(childComplexity), true
case "TransAbsensiCheckDistanceResponse.message":
if e.complexity.TransAbsensiCheckDistanceResponse.Message == nil {
break
}
return e.complexity.TransAbsensiCheckDistanceResponse.Message(childComplexity), true
case "TransAbsensiCheckDistanceResponse.selfie":
if e.complexity.TransAbsensiCheckDistanceResponse.Selfie == nil {
break
}
return e.complexity.TransAbsensiCheckDistanceResponse.Selfie(childComplexity), true
case "TransAbsensiCheckDistanceResponse.status":
if e.complexity.TransAbsensiCheckDistanceResponse.Status == nil {
break
}
return e.complexity.TransAbsensiCheckDistanceResponse.Status(childComplexity), true
case "TransAbsensiCheckDistanceResponse.unit":
if e.complexity.TransAbsensiCheckDistanceResponse.Unit == nil {
break
}
return e.complexity.TransAbsensiCheckDistanceResponse.Unit(childComplexity), true
case "TransAbsensiResponse.message":
if e.complexity.TransAbsensiResponse.Message == nil {
break
@@ -445,23 +480,21 @@ var sources = []*ast.Source{
{Name: "../graphqls/schema.graphqls", Input: ``, BuiltIn: false},
{Name: "../graphqls/staff.graphqls", Input: `# model staff
type Staff {
staff_id: ID!
nip: String!
name: String!
email: String!
phone_number: String
company_id: ID!
company_name: String
company_latitude:String
company_longitude:String
is_active: String
is_login: String
token: String
expired: String
id_google_sign_in: String!
display_name_google_sign_in: String
created_at: String
last_updated_at: String
staff_id: ID!
nip: String!
name: String!
email: String!
phone_number: String
company_id: ID!
company_name: String
is_active: String
is_login: String
token: String
expired: String
id_google_sign_in: String!
display_name_google_sign_in: String
created_at: String
last_updated_at: String
}
# model token response ketika login
@@ -487,16 +520,26 @@ type TransAbsensiResponse {
message: String
}
# check distance response
type TransAbsensiCheckDistanceResponse {
status: String
message: String
selfie: String
max_distance: String
current_distance: String
unit: String
}
# query
extend type Query {
# untuk cek distance dengan fungsi distance_v2 di database
queryCheckDistance(M_StaffID:String!, M_CompanyID:String!, M_CompanyLatitude:String!, M_CompanyLongitude:String!, CurrentLatitude:String!, CurrentLongitude:String!) : TransAbsensiResponse!
# untuk cek distance dengan fungsi distance_v2 di database
queryCheckDistance(M_StaffID:String!, M_CompanyID:String!,CurrentLatitude:String!, CurrentLongitude:String!) : TransAbsensiCheckDistanceResponse!
}
# mutation
extend type Mutation {
# untuk clock in absensi (absensi masuk)
mutationClockInAttendance(T_TransactionM_AbsensiTypeID:String!, T_TransactionM_StaffID:String!, T_TransactionM_CompanyID:String!, T_TransactionCurrentLatitude:String!, T_TransactionCurrentLongitude:String!, T_TransactionDistance:String!, T_TransactionSelfiePhoto:String, T_TransactionNote:String):TransAbsensiResponse!
# untuk clock in absensi (absensi masuk)
mutationClockInAttendance(T_TransactionM_AbsensiTypeID:String!, T_TransactionM_StaffID:String!, T_TransactionM_CompanyID:String!, T_TransactionCurrentLatitude:String!, T_TransactionCurrentLongitude:String!, T_TransactionDistance:String!, T_TransactionSelfiePhoto:String, T_TransactionNote:String):TransAbsensiResponse!
} `, BuiltIn: false},
}
var parsedSchema = gqlparser.MustLoadSchema(sources...)
@@ -644,41 +687,23 @@ func (ec *executionContext) field_Query_queryCheckDistance_args(ctx context.Cont
}
args["M_CompanyID"] = arg1
var arg2 string
if tmp, ok := rawArgs["M_CompanyLatitude"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("M_CompanyLatitude"))
if tmp, ok := rawArgs["CurrentLatitude"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("CurrentLatitude"))
arg2, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["M_CompanyLatitude"] = arg2
args["CurrentLatitude"] = arg2
var arg3 string
if tmp, ok := rawArgs["M_CompanyLongitude"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("M_CompanyLongitude"))
if tmp, ok := rawArgs["CurrentLongitude"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("CurrentLongitude"))
arg3, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["M_CompanyLongitude"] = arg3
var arg4 string
if tmp, ok := rawArgs["CurrentLatitude"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("CurrentLatitude"))
arg4, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["CurrentLatitude"] = arg4
var arg5 string
if tmp, ok := rawArgs["CurrentLongitude"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("CurrentLongitude"))
arg5, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["CurrentLongitude"] = arg5
args["CurrentLongitude"] = arg3
return args, nil
}
@@ -836,10 +861,6 @@ func (ec *executionContext) fieldContext_Mutation_loginAttendance(ctx context.Co
return ec.fieldContext_Staff_company_id(ctx, field)
case "company_name":
return ec.fieldContext_Staff_company_name(ctx, field)
case "company_latitude":
return ec.fieldContext_Staff_company_latitude(ctx, field)
case "company_longitude":
return ec.fieldContext_Staff_company_longitude(ctx, field)
case "is_active":
return ec.fieldContext_Staff_is_active(ctx, field)
case "is_login":
@@ -988,10 +1009,6 @@ func (ec *executionContext) fieldContext_Query_searchStaffByEmail(ctx context.Co
return ec.fieldContext_Staff_company_id(ctx, field)
case "company_name":
return ec.fieldContext_Staff_company_name(ctx, field)
case "company_latitude":
return ec.fieldContext_Staff_company_latitude(ctx, field)
case "company_longitude":
return ec.fieldContext_Staff_company_longitude(ctx, field)
case "is_active":
return ec.fieldContext_Staff_is_active(ctx, field)
case "is_login":
@@ -1079,10 +1096,6 @@ func (ec *executionContext) fieldContext_Query_staffGetByStaffId(ctx context.Con
return ec.fieldContext_Staff_company_id(ctx, field)
case "company_name":
return ec.fieldContext_Staff_company_name(ctx, field)
case "company_latitude":
return ec.fieldContext_Staff_company_latitude(ctx, field)
case "company_longitude":
return ec.fieldContext_Staff_company_longitude(ctx, field)
case "is_active":
return ec.fieldContext_Staff_is_active(ctx, field)
case "is_login":
@@ -1170,10 +1183,6 @@ func (ec *executionContext) fieldContext_Query_staffListBySearch(ctx context.Con
return ec.fieldContext_Staff_company_id(ctx, field)
case "company_name":
return ec.fieldContext_Staff_company_name(ctx, field)
case "company_latitude":
return ec.fieldContext_Staff_company_latitude(ctx, field)
case "company_longitude":
return ec.fieldContext_Staff_company_longitude(ctx, field)
case "is_active":
return ec.fieldContext_Staff_is_active(ctx, field)
case "is_login":
@@ -1222,7 +1231,7 @@ func (ec *executionContext) _Query_queryCheckDistance(ctx context.Context, field
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().QueryCheckDistance(rctx, fc.Args["M_StaffID"].(string), fc.Args["M_CompanyID"].(string), fc.Args["M_CompanyLatitude"].(string), fc.Args["M_CompanyLongitude"].(string), fc.Args["CurrentLatitude"].(string), fc.Args["CurrentLongitude"].(string))
return ec.resolvers.Query().QueryCheckDistance(rctx, fc.Args["M_StaffID"].(string), fc.Args["M_CompanyID"].(string), fc.Args["CurrentLatitude"].(string), fc.Args["CurrentLongitude"].(string))
})
if err != nil {
ec.Error(ctx, err)
@@ -1234,9 +1243,9 @@ func (ec *executionContext) _Query_queryCheckDistance(ctx context.Context, field
}
return graphql.Null
}
res := resTmp.(*model.TransAbsensiResponse)
res := resTmp.(*model.TransAbsensiCheckDistanceResponse)
fc.Result = res
return ec.marshalNTransAbsensiResponse2ᚖcomᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiResponse(ctx, field.Selections, res)
return ec.marshalNTransAbsensiCheckDistanceResponse2ᚖcomᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiCheckDistanceResponse(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Query_queryCheckDistance(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@@ -1248,11 +1257,19 @@ func (ec *executionContext) fieldContext_Query_queryCheckDistance(ctx context.Co
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "status":
return ec.fieldContext_TransAbsensiResponse_status(ctx, field)
return ec.fieldContext_TransAbsensiCheckDistanceResponse_status(ctx, field)
case "message":
return ec.fieldContext_TransAbsensiResponse_message(ctx, field)
return ec.fieldContext_TransAbsensiCheckDistanceResponse_message(ctx, field)
case "selfie":
return ec.fieldContext_TransAbsensiCheckDistanceResponse_selfie(ctx, field)
case "max_distance":
return ec.fieldContext_TransAbsensiCheckDistanceResponse_max_distance(ctx, field)
case "current_distance":
return ec.fieldContext_TransAbsensiCheckDistanceResponse_current_distance(ctx, field)
case "unit":
return ec.fieldContext_TransAbsensiCheckDistanceResponse_unit(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type TransAbsensiResponse", field.Name)
return nil, fmt.Errorf("no field named %q was found under type TransAbsensiCheckDistanceResponse", field.Name)
},
}
defer func() {
@@ -1700,88 +1717,6 @@ func (ec *executionContext) fieldContext_Staff_company_name(ctx context.Context,
return fc, nil
}
func (ec *executionContext) _Staff_company_latitude(ctx context.Context, field graphql.CollectedField, obj *model.Staff) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Staff_company_latitude(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.CompanyLatitude, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*string)
fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Staff_company_latitude(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Staff",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _Staff_company_longitude(ctx context.Context, field graphql.CollectedField, obj *model.Staff) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Staff_company_longitude(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.CompanyLongitude, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*string)
fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Staff_company_longitude(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Staff",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _Staff_is_active(ctx context.Context, field graphql.CollectedField, obj *model.Staff) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Staff_is_active(ctx, field)
if err != nil {
@@ -2195,6 +2130,252 @@ func (ec *executionContext) fieldContext_TokenResponse_message(ctx context.Conte
return fc, nil
}
func (ec *executionContext) _TransAbsensiCheckDistanceResponse_status(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckDistanceResponse) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TransAbsensiCheckDistanceResponse_status(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Status, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*string)
fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TransAbsensiCheckDistanceResponse_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TransAbsensiCheckDistanceResponse",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TransAbsensiCheckDistanceResponse_message(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckDistanceResponse) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TransAbsensiCheckDistanceResponse_message(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Message, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*string)
fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TransAbsensiCheckDistanceResponse_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TransAbsensiCheckDistanceResponse",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TransAbsensiCheckDistanceResponse_selfie(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckDistanceResponse) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TransAbsensiCheckDistanceResponse_selfie(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Selfie, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*string)
fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TransAbsensiCheckDistanceResponse_selfie(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TransAbsensiCheckDistanceResponse",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TransAbsensiCheckDistanceResponse_max_distance(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckDistanceResponse) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TransAbsensiCheckDistanceResponse_max_distance(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.MaxDistance, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*string)
fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TransAbsensiCheckDistanceResponse_max_distance(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TransAbsensiCheckDistanceResponse",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TransAbsensiCheckDistanceResponse_current_distance(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckDistanceResponse) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TransAbsensiCheckDistanceResponse_current_distance(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.CurrentDistance, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*string)
fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TransAbsensiCheckDistanceResponse_current_distance(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TransAbsensiCheckDistanceResponse",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TransAbsensiCheckDistanceResponse_unit(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckDistanceResponse) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TransAbsensiCheckDistanceResponse_unit(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Unit, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*string)
fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TransAbsensiCheckDistanceResponse_unit(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TransAbsensiCheckDistanceResponse",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TransAbsensiResponse_status(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiResponse) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TransAbsensiResponse_status(ctx, field)
if err != nil {
@@ -4292,10 +4473,6 @@ func (ec *executionContext) _Staff(ctx context.Context, sel ast.SelectionSet, ob
}
case "company_name":
out.Values[i] = ec._Staff_company_name(ctx, field, obj)
case "company_latitude":
out.Values[i] = ec._Staff_company_latitude(ctx, field, obj)
case "company_longitude":
out.Values[i] = ec._Staff_company_longitude(ctx, field, obj)
case "is_active":
out.Values[i] = ec._Staff_is_active(ctx, field, obj)
case "is_login":
@@ -4376,6 +4553,52 @@ func (ec *executionContext) _TokenResponse(ctx context.Context, sel ast.Selectio
return out
}
var transAbsensiCheckDistanceResponseImplementors = []string{"TransAbsensiCheckDistanceResponse"}
func (ec *executionContext) _TransAbsensiCheckDistanceResponse(ctx context.Context, sel ast.SelectionSet, obj *model.TransAbsensiCheckDistanceResponse) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, transAbsensiCheckDistanceResponseImplementors)
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
for i, field := range fields {
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("TransAbsensiCheckDistanceResponse")
case "status":
out.Values[i] = ec._TransAbsensiCheckDistanceResponse_status(ctx, field, obj)
case "message":
out.Values[i] = ec._TransAbsensiCheckDistanceResponse_message(ctx, field, obj)
case "selfie":
out.Values[i] = ec._TransAbsensiCheckDistanceResponse_selfie(ctx, field, obj)
case "max_distance":
out.Values[i] = ec._TransAbsensiCheckDistanceResponse_max_distance(ctx, field, obj)
case "current_distance":
out.Values[i] = ec._TransAbsensiCheckDistanceResponse_current_distance(ctx, field, obj)
case "unit":
out.Values[i] = ec._TransAbsensiCheckDistanceResponse_unit(ctx, field, obj)
default:
panic("unknown field " + strconv.Quote(field.Name))
}
}
out.Dispatch(ctx)
if out.Invalids > 0 {
return graphql.Null
}
atomic.AddInt32(&ec.deferred, int32(len(deferred)))
for label, dfs := range deferred {
ec.processDeferredGroup(graphql.DeferredGroup{
Label: label,
Path: graphql.GetPath(ctx),
FieldSet: dfs,
Context: ctx,
})
}
return out
}
var transAbsensiResponseImplementors = []string{"TransAbsensiResponse"}
func (ec *executionContext) _TransAbsensiResponse(ctx context.Context, sel ast.SelectionSet, obj *model.TransAbsensiResponse) graphql.Marshaler {
@@ -4843,6 +5066,20 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S
return res
}
func (ec *executionContext) marshalNTransAbsensiCheckDistanceResponse2comᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiCheckDistanceResponse(ctx context.Context, sel ast.SelectionSet, v model.TransAbsensiCheckDistanceResponse) graphql.Marshaler {
return ec._TransAbsensiCheckDistanceResponse(ctx, sel, &v)
}
func (ec *executionContext) marshalNTransAbsensiCheckDistanceResponse2ᚖcomᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiCheckDistanceResponse(ctx context.Context, sel ast.SelectionSet, v *model.TransAbsensiCheckDistanceResponse) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._TransAbsensiCheckDistanceResponse(ctx, sel, v)
}
func (ec *executionContext) marshalNTransAbsensiResponse2comᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiResponse(ctx context.Context, sel ast.SelectionSet, v model.TransAbsensiResponse) graphql.Marshaler {
return ec._TransAbsensiResponse(ctx, sel, &v)
}