step 9 : absensi clock out, revisi clock in add jam clock in

This commit is contained in:
sindhu
2024-01-23 15:33:18 +07:00
parent f83fe2dab0
commit b65399e11e
5 changed files with 374 additions and 2 deletions

View File

@@ -47,8 +47,9 @@ type DirectiveRoot struct {
type ComplexityRoot struct {
Mutation struct {
LoginAttendance func(childComplexity int, email string, idGoogleSignIn string) int
MutationClockInAttendance func(childComplexity int, tTransactionMStaffID string, tTransactionMCompanyID string, tTransactionCurrentLatitude string, tTransactionCurrentLongitude string, tTransactionCurrentDistance string, tTransactionSelfiePhoto *string, token string, isSelfie string) int
LoginAttendance func(childComplexity int, email string, idGoogleSignIn string) int
MutationClockInAttendance func(childComplexity int, tTransactionMStaffID string, tTransactionMCompanyID string, tTransactionCurrentLatitude string, tTransactionCurrentLongitude string, tTransactionCurrentDistance string, tTransactionSelfiePhoto *string, token string, isSelfie string) int
MutationClockOutAttendance func(childComplexity int, tTransactionMStaffID string, tTransactionMCompanyID string, tTransactionCurrentLatitude string, tTransactionCurrentLongitude string, tTransactionCurrentDistance string, tTransactionSelfiePhoto *string, token string, isSelfie string) int
}
Query struct {
@@ -99,6 +100,7 @@ type ComplexityRoot struct {
type MutationResolver interface {
LoginAttendance(ctx context.Context, email string, idGoogleSignIn string) (*model.Staff, error)
MutationClockInAttendance(ctx context.Context, tTransactionMStaffID string, tTransactionMCompanyID string, tTransactionCurrentLatitude string, tTransactionCurrentLongitude string, tTransactionCurrentDistance string, tTransactionSelfiePhoto *string, token string, isSelfie string) (*model.TransAbsensiResponse, error)
MutationClockOutAttendance(ctx context.Context, tTransactionMStaffID string, tTransactionMCompanyID string, tTransactionCurrentLatitude string, tTransactionCurrentLongitude string, tTransactionCurrentDistance string, tTransactionSelfiePhoto *string, token string, isSelfie string) (*model.TransAbsensiResponse, error)
}
type QueryResolver interface {
SearchStaffByEmail(ctx context.Context, email string) (*model.Staff, error)
@@ -150,6 +152,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Mutation.MutationClockInAttendance(childComplexity, args["T_TransactionM_StaffID"].(string), args["T_TransactionM_CompanyID"].(string), args["T_TransactionCurrentLatitude"].(string), args["T_TransactionCurrentLongitude"].(string), args["T_TransactionCurrentDistance"].(string), args["T_TransactionSelfiePhoto"].(*string), args["token"].(string), args["isSelfie"].(string)), true
case "Mutation.mutationClockOutAttendance":
if e.complexity.Mutation.MutationClockOutAttendance == nil {
break
}
args, err := ec.field_Mutation_mutationClockOutAttendance_args(context.TODO(), rawArgs)
if err != nil {
return 0, false
}
return e.complexity.Mutation.MutationClockOutAttendance(childComplexity, args["T_TransactionM_StaffID"].(string), args["T_TransactionM_CompanyID"].(string), args["T_TransactionCurrentLatitude"].(string), args["T_TransactionCurrentLongitude"].(string), args["T_TransactionCurrentDistance"].(string), args["T_TransactionSelfiePhoto"].(*string), args["token"].(string), args["isSelfie"].(string)), true
case "Query.queryCheckDistance":
if e.complexity.Query.QueryCheckDistance == nil {
break
@@ -540,6 +554,9 @@ extend type Query {
extend type Mutation {
# untuk clock in absensi (absensi masuk)
mutationClockInAttendance(T_TransactionM_StaffID:String!, T_TransactionM_CompanyID:String!, T_TransactionCurrentLatitude:String!, T_TransactionCurrentLongitude:String!, T_TransactionCurrentDistance:String!, T_TransactionSelfiePhoto:String, token:String!, isSelfie:String!):TransAbsensiResponse!
# untuk clock out absensi (absensi pulang)
mutationClockOutAttendance(T_TransactionM_StaffID:String!, T_TransactionM_CompanyID:String!, T_TransactionCurrentLatitude:String!, T_TransactionCurrentLongitude:String!, T_TransactionCurrentDistance:String!, T_TransactionSelfiePhoto:String, token:String!, isSelfie:String!):TransAbsensiResponse!
} `, BuiltIn: false},
}
var parsedSchema = gqlparser.MustLoadSchema(sources...)
@@ -650,6 +667,84 @@ func (ec *executionContext) field_Mutation_mutationClockInAttendance_args(ctx co
return args, nil
}
func (ec *executionContext) field_Mutation_mutationClockOutAttendance_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 string
if tmp, ok := rawArgs["T_TransactionM_StaffID"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("T_TransactionM_StaffID"))
arg0, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["T_TransactionM_StaffID"] = arg0
var arg1 string
if tmp, ok := rawArgs["T_TransactionM_CompanyID"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("T_TransactionM_CompanyID"))
arg1, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["T_TransactionM_CompanyID"] = arg1
var arg2 string
if tmp, ok := rawArgs["T_TransactionCurrentLatitude"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("T_TransactionCurrentLatitude"))
arg2, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["T_TransactionCurrentLatitude"] = arg2
var arg3 string
if tmp, ok := rawArgs["T_TransactionCurrentLongitude"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("T_TransactionCurrentLongitude"))
arg3, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["T_TransactionCurrentLongitude"] = arg3
var arg4 string
if tmp, ok := rawArgs["T_TransactionCurrentDistance"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("T_TransactionCurrentDistance"))
arg4, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["T_TransactionCurrentDistance"] = arg4
var arg5 *string
if tmp, ok := rawArgs["T_TransactionSelfiePhoto"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("T_TransactionSelfiePhoto"))
arg5, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
if err != nil {
return nil, err
}
}
args["T_TransactionSelfiePhoto"] = arg5
var arg6 string
if tmp, ok := rawArgs["token"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("token"))
arg6, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["token"] = arg6
var arg7 string
if tmp, ok := rawArgs["isSelfie"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isSelfie"))
arg7, err = ec.unmarshalNString2string(ctx, tmp)
if err != nil {
return nil, err
}
}
args["isSelfie"] = arg7
return args, nil
}
func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
@@ -956,6 +1051,67 @@ func (ec *executionContext) fieldContext_Mutation_mutationClockInAttendance(ctx
return fc, nil
}
func (ec *executionContext) _Mutation_mutationClockOutAttendance(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_mutationClockOutAttendance(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 ec.resolvers.Mutation().MutationClockOutAttendance(rctx, fc.Args["T_TransactionM_StaffID"].(string), fc.Args["T_TransactionM_CompanyID"].(string), fc.Args["T_TransactionCurrentLatitude"].(string), fc.Args["T_TransactionCurrentLongitude"].(string), fc.Args["T_TransactionCurrentDistance"].(string), fc.Args["T_TransactionSelfiePhoto"].(*string), fc.Args["token"].(string), fc.Args["isSelfie"].(string))
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*model.TransAbsensiResponse)
fc.Result = res
return ec.marshalNTransAbsensiResponse2ᚖcomᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiResponse(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Mutation_mutationClockOutAttendance(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Mutation",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "status":
return ec.fieldContext_TransAbsensiResponse_status(ctx, field)
case "message":
return ec.fieldContext_TransAbsensiResponse_message(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type TransAbsensiResponse", field.Name)
},
}
defer func() {
if r := recover(); r != nil {
err = ec.Recover(ctx, r)
ec.Error(ctx, err)
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
if fc.Args, err = ec.field_Mutation_mutationClockOutAttendance_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
ec.Error(ctx, err)
return fc, err
}
return fc, nil
}
func (ec *executionContext) _Query_searchStaffByEmail(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Query_searchStaffByEmail(ctx, field)
if err != nil {
@@ -4272,6 +4428,13 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "mutationClockOutAttendance":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_mutationClockOutAttendance(ctx, field)
})
if out.Values[i] == graphql.Null {
out.Invalids++
}
default:
panic("unknown field " + strconv.Quote(field.Name))
}