step 5 : add comp longi & lati, check distance gql, trans clock in gql

This commit is contained in:
sindhu
2024-01-22 15:11:44 +07:00
parent c62764165d
commit ba1f43ae70
12 changed files with 548 additions and 697 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +0,0 @@
# GraphQL schema example
#
# https://gqlgen.com/getting-started/
type Todo {
id: ID!
text: String!
done: Boolean!
user: User!
}
type User {
id: ID!
name: String!
}
type Query {
todos: [Todo!]!
}
input NewTodo {
text: String!
userId: String!
}
type Mutation {
createTodo(input: NewTodo!): Todo!
}

View File

@@ -1,20 +1,22 @@
# model staff
type Staff {
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
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
}
# model token response ketika login

View File

@@ -0,0 +1,17 @@
# response error atau success dan set message
type TransAbsensiResponse {
status: String
message: 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!
}
# 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!
}

View File

@@ -5,11 +5,6 @@ package model
type Mutation struct {
}
type NewTodo struct {
Text string `json:"text"`
UserID string `json:"userId"`
}
type Query struct {
}
@@ -21,6 +16,8 @@ type Staff struct {
PhoneNumber *string `json:"phone_number,omitempty"`
CompanyID string `json:"company_id"`
CompanyName *string `json:"company_name,omitempty"`
CompanyLatitude *string `json:"company_latitude,omitempty"`
CompanyLongitude *string `json:"company_longitude,omitempty"`
IsActive *string `json:"is_active,omitempty"`
IsLogin *string `json:"is_login,omitempty"`
Token *string `json:"token,omitempty"`
@@ -31,19 +28,12 @@ type Staff struct {
LastUpdatedAt *string `json:"last_updated_at,omitempty"`
}
type Todo struct {
ID string `json:"id"`
Text string `json:"text"`
Done bool `json:"done"`
User *User `json:"user"`
}
type TokenResponse struct {
Token *string `json:"token,omitempty"`
Message *string `json:"message,omitempty"`
}
type User struct {
ID string `json:"id"`
Name string `json:"name"`
type TransAbsensiResponse struct {
Status *string `json:"status,omitempty"`
Message *string `json:"message,omitempty"`
}

View File

@@ -1,32 +1 @@
package resolver
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.42
import (
"context"
"fmt"
"com.sismedika.com.absensi/graph/generated"
"com.sismedika.com.absensi/graph/model"
)
// CreateTodo is the resolver for the createTodo field.
func (r *mutationResolver) CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error) {
panic(fmt.Errorf("not implemented: CreateTodo - createTodo"))
}
// Todos is the resolver for the todos field.
func (r *queryResolver) Todos(ctx context.Context) ([]*model.Todo, error) {
panic(fmt.Errorf("not implemented: Todos - todos"))
}
// Mutation returns generated.MutationResolver implementation.
func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }
// Query returns generated.QueryResolver implementation.
func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }
type mutationResolver struct{ *Resolver }
type queryResolver struct{ *Resolver }

View File

@@ -2,12 +2,13 @@ package resolver
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.42
// Code generated by github.com/99designs/gqlgen version v0.17.43-dev
import (
"context"
"fmt"
"com.sismedika.com.absensi/graph/generated"
"com.sismedika.com.absensi/graph/model"
staffinternal "com.sismedika.com.absensi/internal/staff"
)
@@ -35,12 +36,11 @@ func (r *queryResolver) StaffListBySearch(ctx context.Context, search *string, p
panic(fmt.Errorf("not implemented: StaffListBySearch - staffListBySearch"))
}
// !!! WARNING !!!
// The code below was going to be deleted when updating resolvers. It has been copied here so you have
// one last chance to move it out of harms way if you want. There are two reasons this happens:
// - When renaming or deleting a resolver the old code will be put in here. You can safely delete
// it when you're done.
// - You have helper methods in this file. Move them out to keep these resolver files clean.
func (r *mutationResolver) GenerateToken(ctx context.Context, email string, idGoogleSignIn string, publickey string) (*model.TokenResponse, error) {
panic(fmt.Errorf("not implemented: GenerateToken - generateToken"))
}
// Mutation returns generated.MutationResolver implementation.
func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }
// Query returns generated.QueryResolver implementation.
func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }
type mutationResolver struct{ *Resolver }
type queryResolver struct{ *Resolver }

View File

@@ -0,0 +1,35 @@
package resolver
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.43-dev
import (
"context"
"fmt"
"com.sismedika.com.absensi/graph/model"
)
// MutationClockInAttendance is the resolver for the mutationClockInAttendance field.
func (r *mutationResolver) MutationClockInAttendance(ctx context.Context, tTransactionMAbsensiTypeID string, tTransactionMStaffID string, tTransactionMCompanyID string, tTransactionCurrentLatitude string, tTransactionCurrentLongitude string, tTransactionDistance string, tTransactionSelfiePhoto *string, tTransactionNote *string) (*model.TransAbsensiResponse, error) {
panic(fmt.Errorf("not implemented: MutationClockInAttendance - mutationClockInAttendance"))
}
// QueryCheckDistance is the resolver for the queryCheckDistance field.
func (r *queryResolver) QueryCheckDistance(ctx context.Context, mStaffID string, mCompanyID string, mCompanyLatitude string, mCompanyLongitude string, currentLatitude string, currentLongitude string) (*model.TransAbsensiResponse, error) {
panic(fmt.Errorf("not implemented: QueryCheckDistance - queryCheckDistance"))
}
// !!! WARNING !!!
// The code below was going to be deleted when updating resolvers. It has been copied here so you have
// one last chance to move it out of harms way if you want. There are two reasons this happens:
// - When renaming or deleting a resolver the old code will be put in here. You can safely delete
// it when you're done.
// - You have helper methods in this file. Move them out to keep these resolver files clean.
func (r *mutationResolver) MClockInAttendance(ctx context.Context, tTransactionMAbsensiTypeID string, tTransactionMStaffID string, tTransactionMCompanyID string, tTransactionCurrentLatitude string, tTransactionCurrentLongitude string, tTransactionDistance string, tTransactionSelfiePhoto *string, tTransactionNote *string) (*model.TransAbsensiResponse, error) {
panic(fmt.Errorf("not implemented: MClockInAttendance - mClockInAttendance"))
}
func (r *queryResolver) QCheckDistance(ctx context.Context, mStaffID string, mCompanyID string, mCompanyLatitude string, mCompanyLongitude string, currentLatitude string, currentLongitude string) (*model.TransAbsensiResponse, error) {
panic(fmt.Errorf("not implemented: QCheckDistance - qCheckDistance"))
}