step 10 : fungsi cek presensi clock in dan clock out
This commit is contained in:
@@ -53,10 +53,11 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Query struct {
|
Query struct {
|
||||||
QueryCheckDistance func(childComplexity int, mStaffID string, mCompanyID 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
|
QueryCheckTimeAttendance func(childComplexity int, mStaffID string, mCompanyID string, token string) int
|
||||||
StaffGetByStaffID func(childComplexity int, staffID string) int
|
SearchStaffByEmail func(childComplexity int, email string) int
|
||||||
StaffListBySearch func(childComplexity int, search *string, page *int, maxPerPage *int) int
|
StaffGetByStaffID func(childComplexity int, staffID string) int
|
||||||
|
StaffListBySearch func(childComplexity int, search *string, page *int, maxPerPage *int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
Staff struct {
|
Staff struct {
|
||||||
@@ -91,6 +92,15 @@ type ComplexityRoot struct {
|
|||||||
Unit func(childComplexity int) int
|
Unit func(childComplexity int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransAbsensiCheckTimeAttendanceResponse struct {
|
||||||
|
IsAbsenClockIn func(childComplexity int) int
|
||||||
|
IsAbsenClockOut func(childComplexity int) int
|
||||||
|
JamClockIn func(childComplexity int) int
|
||||||
|
JamClockOut func(childComplexity int) int
|
||||||
|
Message func(childComplexity int) int
|
||||||
|
Status func(childComplexity int) int
|
||||||
|
}
|
||||||
|
|
||||||
TransAbsensiResponse struct {
|
TransAbsensiResponse struct {
|
||||||
Message func(childComplexity int) int
|
Message func(childComplexity int) int
|
||||||
Status func(childComplexity int) int
|
Status func(childComplexity int) int
|
||||||
@@ -107,6 +117,7 @@ type QueryResolver interface {
|
|||||||
StaffGetByStaffID(ctx context.Context, staffID 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)
|
StaffListBySearch(ctx context.Context, search *string, page *int, maxPerPage *int) ([]*model.Staff, error)
|
||||||
QueryCheckDistance(ctx context.Context, mStaffID string, mCompanyID string, currentLatitude string, currentLongitude string) (*model.TransAbsensiCheckDistanceResponse, error)
|
QueryCheckDistance(ctx context.Context, mStaffID string, mCompanyID string, currentLatitude string, currentLongitude string) (*model.TransAbsensiCheckDistanceResponse, error)
|
||||||
|
QueryCheckTimeAttendance(ctx context.Context, mStaffID string, mCompanyID string, token string) (*model.TransAbsensiCheckTimeAttendanceResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type executableSchema struct {
|
type executableSchema struct {
|
||||||
@@ -176,6 +187,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.Query.QueryCheckDistance(childComplexity, args["M_StaffID"].(string), args["M_CompanyID"].(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.queryCheckTimeAttendance":
|
||||||
|
if e.complexity.Query.QueryCheckTimeAttendance == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
args, err := ec.field_Query_queryCheckTimeAttendance_args(context.TODO(), rawArgs)
|
||||||
|
if err != nil {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Query.QueryCheckTimeAttendance(childComplexity, args["M_StaffID"].(string), args["M_CompanyID"].(string), args["token"].(string)), true
|
||||||
|
|
||||||
case "Query.searchStaffByEmail":
|
case "Query.searchStaffByEmail":
|
||||||
if e.complexity.Query.SearchStaffByEmail == nil {
|
if e.complexity.Query.SearchStaffByEmail == nil {
|
||||||
break
|
break
|
||||||
@@ -373,6 +396,48 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.TransAbsensiCheckDistanceResponse.Unit(childComplexity), true
|
return e.complexity.TransAbsensiCheckDistanceResponse.Unit(childComplexity), true
|
||||||
|
|
||||||
|
case "TransAbsensiCheckTimeAttendanceResponse.is_absen_clock_in":
|
||||||
|
if e.complexity.TransAbsensiCheckTimeAttendanceResponse.IsAbsenClockIn == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.TransAbsensiCheckTimeAttendanceResponse.IsAbsenClockIn(childComplexity), true
|
||||||
|
|
||||||
|
case "TransAbsensiCheckTimeAttendanceResponse.is_absen_clock_out":
|
||||||
|
if e.complexity.TransAbsensiCheckTimeAttendanceResponse.IsAbsenClockOut == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.TransAbsensiCheckTimeAttendanceResponse.IsAbsenClockOut(childComplexity), true
|
||||||
|
|
||||||
|
case "TransAbsensiCheckTimeAttendanceResponse.jam_clock_in":
|
||||||
|
if e.complexity.TransAbsensiCheckTimeAttendanceResponse.JamClockIn == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.TransAbsensiCheckTimeAttendanceResponse.JamClockIn(childComplexity), true
|
||||||
|
|
||||||
|
case "TransAbsensiCheckTimeAttendanceResponse.jam_clock_out":
|
||||||
|
if e.complexity.TransAbsensiCheckTimeAttendanceResponse.JamClockOut == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.TransAbsensiCheckTimeAttendanceResponse.JamClockOut(childComplexity), true
|
||||||
|
|
||||||
|
case "TransAbsensiCheckTimeAttendanceResponse.message":
|
||||||
|
if e.complexity.TransAbsensiCheckTimeAttendanceResponse.Message == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.TransAbsensiCheckTimeAttendanceResponse.Message(childComplexity), true
|
||||||
|
|
||||||
|
case "TransAbsensiCheckTimeAttendanceResponse.status":
|
||||||
|
if e.complexity.TransAbsensiCheckTimeAttendanceResponse.Status == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.TransAbsensiCheckTimeAttendanceResponse.Status(childComplexity), true
|
||||||
|
|
||||||
case "TransAbsensiResponse.message":
|
case "TransAbsensiResponse.message":
|
||||||
if e.complexity.TransAbsensiResponse.Message == nil {
|
if e.complexity.TransAbsensiResponse.Message == nil {
|
||||||
break
|
break
|
||||||
@@ -544,10 +609,23 @@ type TransAbsensiCheckDistanceResponse {
|
|||||||
unit: String
|
unit: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# response waktu absen masuk dan pulang
|
||||||
|
type TransAbsensiCheckTimeAttendanceResponse {
|
||||||
|
status: String
|
||||||
|
message: String
|
||||||
|
jam_clock_in: String
|
||||||
|
jam_clock_out: String
|
||||||
|
is_absen_clock_in: String
|
||||||
|
is_absen_clock_out: String
|
||||||
|
}
|
||||||
|
|
||||||
# query
|
# query
|
||||||
extend type Query {
|
extend type Query {
|
||||||
# untuk cek distance dengan fungsi distance_v2 di database
|
# untuk cek distance dengan fungsi distance_v2 di database
|
||||||
queryCheckDistance(M_StaffID:String!, M_CompanyID:String!,CurrentLatitude:String!, CurrentLongitude:String!) : TransAbsensiCheckDistanceResponse!
|
queryCheckDistance(M_StaffID:String!, M_CompanyID:String!,CurrentLatitude:String!, CurrentLongitude:String!) : TransAbsensiCheckDistanceResponse!
|
||||||
|
|
||||||
|
# untuk check waktu absen masuk dan pulang
|
||||||
|
queryCheckTimeAttendance(M_StaffID:String!, M_CompanyID:String!, token:String!) : TransAbsensiCheckTimeAttendanceResponse!
|
||||||
}
|
}
|
||||||
|
|
||||||
# mutation
|
# mutation
|
||||||
@@ -802,6 +880,39 @@ func (ec *executionContext) field_Query_queryCheckDistance_args(ctx context.Cont
|
|||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) field_Query_queryCheckTimeAttendance_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["M_StaffID"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("M_StaffID"))
|
||||||
|
arg0, err = ec.unmarshalNString2string(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["M_StaffID"] = arg0
|
||||||
|
var arg1 string
|
||||||
|
if tmp, ok := rawArgs["M_CompanyID"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("M_CompanyID"))
|
||||||
|
arg1, err = ec.unmarshalNString2string(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["M_CompanyID"] = arg1
|
||||||
|
var arg2 string
|
||||||
|
if tmp, ok := rawArgs["token"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("token"))
|
||||||
|
arg2, err = ec.unmarshalNString2string(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["token"] = arg2
|
||||||
|
return args, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_searchStaffByEmail_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_searchStaffByEmail_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
@@ -1442,6 +1553,75 @@ func (ec *executionContext) fieldContext_Query_queryCheckDistance(ctx context.Co
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Query_queryCheckTimeAttendance(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Query_queryCheckTimeAttendance(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.Query().QueryCheckTimeAttendance(rctx, fc.Args["M_StaffID"].(string), fc.Args["M_CompanyID"].(string), fc.Args["token"].(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.TransAbsensiCheckTimeAttendanceResponse)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNTransAbsensiCheckTimeAttendanceResponse2ᚖcomᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiCheckTimeAttendanceResponse(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Query_queryCheckTimeAttendance(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Query",
|
||||||
|
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_TransAbsensiCheckTimeAttendanceResponse_status(ctx, field)
|
||||||
|
case "message":
|
||||||
|
return ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_message(ctx, field)
|
||||||
|
case "jam_clock_in":
|
||||||
|
return ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_jam_clock_in(ctx, field)
|
||||||
|
case "jam_clock_out":
|
||||||
|
return ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_jam_clock_out(ctx, field)
|
||||||
|
case "is_absen_clock_in":
|
||||||
|
return ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_in(ctx, field)
|
||||||
|
case "is_absen_clock_out":
|
||||||
|
return ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_out(ctx, field)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("no field named %q was found under type TransAbsensiCheckTimeAttendanceResponse", 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_Query_queryCheckTimeAttendance_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return fc, err
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Query___type(ctx, field)
|
fc, err := ec.fieldContext_Query___type(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -2532,6 +2712,252 @@ func (ec *executionContext) fieldContext_TransAbsensiCheckDistanceResponse_unit(
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _TransAbsensiCheckTimeAttendanceResponse_status(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckTimeAttendanceResponse) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_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_TransAbsensiCheckTimeAttendanceResponse_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "TransAbsensiCheckTimeAttendanceResponse",
|
||||||
|
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) _TransAbsensiCheckTimeAttendanceResponse_message(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckTimeAttendanceResponse) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_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_TransAbsensiCheckTimeAttendanceResponse_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "TransAbsensiCheckTimeAttendanceResponse",
|
||||||
|
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) _TransAbsensiCheckTimeAttendanceResponse_jam_clock_in(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckTimeAttendanceResponse) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_jam_clock_in(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.JamClockIn, 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_TransAbsensiCheckTimeAttendanceResponse_jam_clock_in(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "TransAbsensiCheckTimeAttendanceResponse",
|
||||||
|
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) _TransAbsensiCheckTimeAttendanceResponse_jam_clock_out(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckTimeAttendanceResponse) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_jam_clock_out(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.JamClockOut, 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_TransAbsensiCheckTimeAttendanceResponse_jam_clock_out(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "TransAbsensiCheckTimeAttendanceResponse",
|
||||||
|
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) _TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_in(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckTimeAttendanceResponse) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_in(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.IsAbsenClockIn, 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_TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_in(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "TransAbsensiCheckTimeAttendanceResponse",
|
||||||
|
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) _TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_out(ctx context.Context, field graphql.CollectedField, obj *model.TransAbsensiCheckTimeAttendanceResponse) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_out(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.IsAbsenClockOut, 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_TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_out(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "TransAbsensiCheckTimeAttendanceResponse",
|
||||||
|
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) {
|
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)
|
fc, err := ec.fieldContext_TransAbsensiResponse_status(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -4564,6 +4990,28 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
|
|||||||
func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) })
|
||||||
|
case "queryCheckTimeAttendance":
|
||||||
|
field := field
|
||||||
|
|
||||||
|
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
res = ec._Query_queryCheckTimeAttendance(ctx, field)
|
||||||
|
if res == graphql.Null {
|
||||||
|
atomic.AddUint32(&fs.Invalids, 1)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
rrm := func(ctx context.Context) graphql.Marshaler {
|
||||||
|
return ec.OperationContext.RootResolverMiddleware(ctx,
|
||||||
|
func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
||||||
|
}
|
||||||
|
|
||||||
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) })
|
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) })
|
||||||
case "__type":
|
case "__type":
|
||||||
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
||||||
@@ -4762,6 +5210,52 @@ func (ec *executionContext) _TransAbsensiCheckDistanceResponse(ctx context.Conte
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var transAbsensiCheckTimeAttendanceResponseImplementors = []string{"TransAbsensiCheckTimeAttendanceResponse"}
|
||||||
|
|
||||||
|
func (ec *executionContext) _TransAbsensiCheckTimeAttendanceResponse(ctx context.Context, sel ast.SelectionSet, obj *model.TransAbsensiCheckTimeAttendanceResponse) graphql.Marshaler {
|
||||||
|
fields := graphql.CollectFields(ec.OperationContext, sel, transAbsensiCheckTimeAttendanceResponseImplementors)
|
||||||
|
|
||||||
|
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("TransAbsensiCheckTimeAttendanceResponse")
|
||||||
|
case "status":
|
||||||
|
out.Values[i] = ec._TransAbsensiCheckTimeAttendanceResponse_status(ctx, field, obj)
|
||||||
|
case "message":
|
||||||
|
out.Values[i] = ec._TransAbsensiCheckTimeAttendanceResponse_message(ctx, field, obj)
|
||||||
|
case "jam_clock_in":
|
||||||
|
out.Values[i] = ec._TransAbsensiCheckTimeAttendanceResponse_jam_clock_in(ctx, field, obj)
|
||||||
|
case "jam_clock_out":
|
||||||
|
out.Values[i] = ec._TransAbsensiCheckTimeAttendanceResponse_jam_clock_out(ctx, field, obj)
|
||||||
|
case "is_absen_clock_in":
|
||||||
|
out.Values[i] = ec._TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_in(ctx, field, obj)
|
||||||
|
case "is_absen_clock_out":
|
||||||
|
out.Values[i] = ec._TransAbsensiCheckTimeAttendanceResponse_is_absen_clock_out(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"}
|
var transAbsensiResponseImplementors = []string{"TransAbsensiResponse"}
|
||||||
|
|
||||||
func (ec *executionContext) _TransAbsensiResponse(ctx context.Context, sel ast.SelectionSet, obj *model.TransAbsensiResponse) graphql.Marshaler {
|
func (ec *executionContext) _TransAbsensiResponse(ctx context.Context, sel ast.SelectionSet, obj *model.TransAbsensiResponse) graphql.Marshaler {
|
||||||
@@ -5243,6 +5737,20 @@ func (ec *executionContext) marshalNTransAbsensiCheckDistanceResponse2ᚖcomᚗs
|
|||||||
return ec._TransAbsensiCheckDistanceResponse(ctx, sel, v)
|
return ec._TransAbsensiCheckDistanceResponse(ctx, sel, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNTransAbsensiCheckTimeAttendanceResponse2comᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiCheckTimeAttendanceResponse(ctx context.Context, sel ast.SelectionSet, v model.TransAbsensiCheckTimeAttendanceResponse) graphql.Marshaler {
|
||||||
|
return ec._TransAbsensiCheckTimeAttendanceResponse(ctx, sel, &v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNTransAbsensiCheckTimeAttendanceResponse2ᚖcomᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiCheckTimeAttendanceResponse(ctx context.Context, sel ast.SelectionSet, v *model.TransAbsensiCheckTimeAttendanceResponse) 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._TransAbsensiCheckTimeAttendanceResponse(ctx, sel, v)
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) marshalNTransAbsensiResponse2comᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐTransAbsensiResponse(ctx context.Context, sel ast.SelectionSet, v model.TransAbsensiResponse) graphql.Marshaler {
|
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)
|
return ec._TransAbsensiResponse(ctx, sel, &v)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,23 @@ type TransAbsensiCheckDistanceResponse {
|
|||||||
unit: String
|
unit: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# response waktu absen masuk dan pulang
|
||||||
|
type TransAbsensiCheckTimeAttendanceResponse {
|
||||||
|
status: String
|
||||||
|
message: String
|
||||||
|
jam_clock_in: String
|
||||||
|
jam_clock_out: String
|
||||||
|
is_absen_clock_in: String
|
||||||
|
is_absen_clock_out: String
|
||||||
|
}
|
||||||
|
|
||||||
# query
|
# query
|
||||||
extend type Query {
|
extend type Query {
|
||||||
# untuk cek distance dengan fungsi distance_v2 di database
|
# untuk cek distance dengan fungsi distance_v2 di database
|
||||||
queryCheckDistance(M_StaffID:String!, M_CompanyID:String!,CurrentLatitude:String!, CurrentLongitude:String!) : TransAbsensiCheckDistanceResponse!
|
queryCheckDistance(M_StaffID:String!, M_CompanyID:String!,CurrentLatitude:String!, CurrentLongitude:String!) : TransAbsensiCheckDistanceResponse!
|
||||||
|
|
||||||
|
# untuk check waktu absen masuk dan pulang
|
||||||
|
queryCheckTimeAttendance(M_StaffID:String!, M_CompanyID:String!, token:String!) : TransAbsensiCheckTimeAttendanceResponse!
|
||||||
}
|
}
|
||||||
|
|
||||||
# mutation
|
# mutation
|
||||||
|
|||||||
@@ -40,6 +40,15 @@ type TransAbsensiCheckDistanceResponse struct {
|
|||||||
Unit *string `json:"unit,omitempty"`
|
Unit *string `json:"unit,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TransAbsensiCheckTimeAttendanceResponse struct {
|
||||||
|
Status *string `json:"status,omitempty"`
|
||||||
|
Message *string `json:"message,omitempty"`
|
||||||
|
JamClockIn *string `json:"jam_clock_in,omitempty"`
|
||||||
|
JamClockOut *string `json:"jam_clock_out,omitempty"`
|
||||||
|
IsAbsenClockIn *string `json:"is_absen_clock_in,omitempty"`
|
||||||
|
IsAbsenClockOut *string `json:"is_absen_clock_out,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type TransAbsensiResponse struct {
|
type TransAbsensiResponse struct {
|
||||||
Status *string `json:"status,omitempty"`
|
Status *string `json:"status,omitempty"`
|
||||||
Message *string `json:"message,omitempty"`
|
Message *string `json:"message,omitempty"`
|
||||||
|
|||||||
@@ -31,3 +31,10 @@ func (r *queryResolver) QueryCheckDistance(ctx context.Context, mStaffID string,
|
|||||||
var transabsensiinternal transabsensiinternal.TransAbsensiCheckDistanceResponse
|
var transabsensiinternal transabsensiinternal.TransAbsensiCheckDistanceResponse
|
||||||
return transabsensiinternal.CheckDistance(mStaffID, mCompanyID, currentLatitude, currentLongitude)
|
return transabsensiinternal.CheckDistance(mStaffID, mCompanyID, currentLatitude, currentLongitude)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryCheckTimeAttendance is the resolver for the queryCheckTimeAttendance field.
|
||||||
|
func (r *queryResolver) QueryCheckTimeAttendance(ctx context.Context, mStaffID string, mCompanyID string, token string) (*model.TransAbsensiCheckTimeAttendanceResponse, error) {
|
||||||
|
// panic(fmt.Errorf("not implemented: QueryCheckTimeAttendance - queryCheckTimeAttendance"))
|
||||||
|
var transabsensiinternal transabsensiinternal.TransAbsensiCheckTimeAttendanceResponse
|
||||||
|
return transabsensiinternal.CheckTimeAttendance(mStaffID, mCompanyID, token)
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ type TransAbsensiCheckDistanceResponse model.TransAbsensiCheckDistanceResponse
|
|||||||
|
|
||||||
type TransAbsensiResponse model.TransAbsensiResponse
|
type TransAbsensiResponse model.TransAbsensiResponse
|
||||||
|
|
||||||
|
type TransAbsensiCheckTimeAttendanceResponse model.TransAbsensiCheckTimeAttendanceResponse
|
||||||
|
|
||||||
// fungsi untuk Check Distance antara kantor dengan current user location
|
// fungsi untuk Check Distance antara kantor dengan current user location
|
||||||
func (transabsensi *TransAbsensiCheckDistanceResponse) CheckDistance(M_StaffID string, M_CompanyID string, CurrentLatitude string, CurrentLongitude string) (*model.TransAbsensiCheckDistanceResponse, error) {
|
func (transabsensi *TransAbsensiCheckDistanceResponse) CheckDistance(M_StaffID string, M_CompanyID string, CurrentLatitude string, CurrentLongitude string) (*model.TransAbsensiCheckDistanceResponse, error) {
|
||||||
// inisialisasi
|
// inisialisasi
|
||||||
@@ -519,3 +521,154 @@ func (transabsensi *TransAbsensiResponse) ClockOutAbsensi(T_TransactionM_StaffID
|
|||||||
|
|
||||||
return &ret, err
|
return &ret, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fungsi untuk get jam absen dan pulang
|
||||||
|
func (transabsensi *TransAbsensiCheckTimeAttendanceResponse) CheckTimeAttendance(M_StaffID string, M_CompanyID string, token string) (*model.TransAbsensiCheckTimeAttendanceResponse, error) {
|
||||||
|
|
||||||
|
// inisialisasi
|
||||||
|
var err error
|
||||||
|
var ret model.TransAbsensiCheckTimeAttendanceResponse
|
||||||
|
|
||||||
|
var var_jam_clock_in string
|
||||||
|
var var_jam_clock_out string
|
||||||
|
var var_is_absen_clock_in string = "FALSE"
|
||||||
|
var var_is_absen_clock_out string = "FALSE"
|
||||||
|
|
||||||
|
var varGetToken string
|
||||||
|
var resultsArrayAttendance []struct {
|
||||||
|
T_TransactionM_AbsensiTypeID string
|
||||||
|
T_TransactionClockAbsensi string
|
||||||
|
}
|
||||||
|
|
||||||
|
ret.Status = new(string)
|
||||||
|
ret.Message = new(string)
|
||||||
|
ret.JamClockIn = new(string)
|
||||||
|
ret.JamClockOut = new(string)
|
||||||
|
ret.IsAbsenClockIn = new(string)
|
||||||
|
ret.IsAbsenClockOut = new(string)
|
||||||
|
|
||||||
|
qCheckTokenStaff := `SELECT
|
||||||
|
M_StaffToken
|
||||||
|
FROM m_staff
|
||||||
|
WHERE M_StaffIsActive = 'Y'
|
||||||
|
AND M_StaffToken = ?
|
||||||
|
`
|
||||||
|
|
||||||
|
rowCheckTokenStaff := db.Handle.QueryRow(
|
||||||
|
qCheckTokenStaff,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
|
||||||
|
db.LogSQL(qCheckTokenStaff)
|
||||||
|
err = rowCheckTokenStaff.Scan(
|
||||||
|
&varGetToken,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error m_staff select token: %v", err)
|
||||||
|
log.Printf("Executing query: %s\n", qCheckTokenStaff)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// check varGetToken jk M_StaffToken kosong
|
||||||
|
if varGetToken == "" {
|
||||||
|
log.Printf("Error Token Kosong, Silahkan Login Dulu: %v", err)
|
||||||
|
log.Printf("Executing query: %s\n", qCheckTokenStaff)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// proses check attendance
|
||||||
|
if varGetToken != "" {
|
||||||
|
q := `SELECT T_TransactionM_AbsensiTypeID,
|
||||||
|
DATE_FORMAT(T_TransactionClockAbsensi,'%H:%i') as T_TransactionClockAbsensi
|
||||||
|
FROM t_transaction
|
||||||
|
WHERE T_TransactionIsActive = 'Y'
|
||||||
|
AND T_TransactionM_AbsensiTypeID IN (1, 2)
|
||||||
|
AND T_TransactionM_StaffID = ?
|
||||||
|
AND T_TransactionM_CompanyID = ?
|
||||||
|
AND T_TransactionDate BETWEEN DATE_FORMAT(NOW(), "%Y-%m-%d 01:00:00")
|
||||||
|
AND DATE_FORMAT(NOW(), "%Y-%m-%d 23:00:00")
|
||||||
|
ORDER BY T_TransactionM_AbsensiTypeID ASC`
|
||||||
|
|
||||||
|
db.LogSQL(q, M_StaffID,
|
||||||
|
M_CompanyID)
|
||||||
|
|
||||||
|
rows, err := db.Handle.Query(
|
||||||
|
q,
|
||||||
|
M_StaffID,
|
||||||
|
M_CompanyID)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error m_company select jam_clock_in dan jam_clock_out: %v", err)
|
||||||
|
log.Printf("Executing query: %s\n", q)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
|
for rows.Next() {
|
||||||
|
var resultTmp struct {
|
||||||
|
T_TransactionM_AbsensiTypeID string
|
||||||
|
T_TransactionClockAbsensi string
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := rows.Scan(
|
||||||
|
&resultTmp.T_TransactionM_AbsensiTypeID,
|
||||||
|
&resultTmp.T_TransactionClockAbsensi,
|
||||||
|
); err != nil {
|
||||||
|
log.Printf("Error scanning row: %v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// array push
|
||||||
|
resultsArrayAttendance = append(resultsArrayAttendance, resultTmp)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
log.Printf("Error after iterating rows attendance : %v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// check length resultsArrayAttendance
|
||||||
|
if len(resultsArrayAttendance) == 0 {
|
||||||
|
log.Printf("Error Data Tidak Ada: %v", err)
|
||||||
|
*ret.Status = "OK"
|
||||||
|
*ret.Message = "Belum Ada Absen"
|
||||||
|
*ret.JamClockIn = ""
|
||||||
|
*ret.JamClockOut = ""
|
||||||
|
*ret.IsAbsenClockIn = "FALSE"
|
||||||
|
*ret.IsAbsenClockOut = "FALSE"
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(resultsArrayAttendance) > 0 {
|
||||||
|
for _, result := range resultsArrayAttendance {
|
||||||
|
// clock in (absen masuk)
|
||||||
|
if result.T_TransactionM_AbsensiTypeID == "1" {
|
||||||
|
var_jam_clock_in = result.T_TransactionClockAbsensi
|
||||||
|
|
||||||
|
if var_is_absen_clock_in != "" {
|
||||||
|
var_is_absen_clock_in = "TRUE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clock out (absen pulang)
|
||||||
|
if result.T_TransactionM_AbsensiTypeID == "2" {
|
||||||
|
var_jam_clock_out = result.T_TransactionClockAbsensi
|
||||||
|
|
||||||
|
if var_is_absen_clock_out != "" {
|
||||||
|
var_is_absen_clock_out = "TRUE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*ret.Status = "OK"
|
||||||
|
*ret.Message = "Sudah Ada Absen"
|
||||||
|
*ret.JamClockIn = var_jam_clock_in
|
||||||
|
*ret.JamClockOut = var_jam_clock_out
|
||||||
|
*ret.IsAbsenClockIn = var_is_absen_clock_in
|
||||||
|
*ret.IsAbsenClockOut = var_is_absen_clock_out
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &ret, err
|
||||||
|
}
|
||||||
|
|||||||
BIN
backend/server
BIN
backend/server
Binary file not shown.
Reference in New Issue
Block a user