1. inisialisasi backend golang
This commit is contained in:
5446
backend/graph/generated/generated.go
Normal file
5446
backend/graph/generated/generated.go
Normal file
File diff suppressed because it is too large
Load Diff
28
backend/graph/graphqls/schema.graphqls
Normal file
28
backend/graph/graphqls/schema.graphqls
Normal file
@@ -0,0 +1,28 @@
|
||||
# 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!
|
||||
}
|
||||
34
backend/graph/graphqls/staff.graphqls
Normal file
34
backend/graph/graphqls/staff.graphqls
Normal file
@@ -0,0 +1,34 @@
|
||||
# model staff
|
||||
type Staff {
|
||||
staff_id: ID!
|
||||
nip: String!
|
||||
name: String!
|
||||
email: String!
|
||||
phone_number: String
|
||||
is_active: String
|
||||
is_login: Boolean
|
||||
token: String
|
||||
id_google_sign_in: String!
|
||||
display_name_google_sign_in: String
|
||||
created_at: String
|
||||
last_updated_at: String
|
||||
}
|
||||
|
||||
# model token response ketika login
|
||||
type TokenResponse {
|
||||
token: String
|
||||
message: String
|
||||
}
|
||||
|
||||
# query search
|
||||
extend type Query {
|
||||
searchStaffByEmail(email: String!): Staff!
|
||||
staffGetByStaffId(staff_id: ID!): Staff!
|
||||
staffListBySearch(search:String, page:Int, maxPerPage: Int): [Staff!]!
|
||||
}
|
||||
|
||||
# mutation untuk perubahan data
|
||||
extend type Mutation {
|
||||
generateToken(email: String!, id_google_sign_in:String!): TokenResponse!
|
||||
loginAttendance(email:String!, id_google_sign_in:String!) : Staff!
|
||||
}
|
||||
46
backend/graph/model/models_gen.go
Normal file
46
backend/graph/model/models_gen.go
Normal file
@@ -0,0 +1,46 @@
|
||||
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
type Mutation struct {
|
||||
}
|
||||
|
||||
type NewTodo struct {
|
||||
Text string `json:"text"`
|
||||
UserID string `json:"userId"`
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
}
|
||||
|
||||
type Staff struct {
|
||||
StaffID string `json:"staff_id"`
|
||||
Nip string `json:"nip"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
PhoneNumber *string `json:"phone_number,omitempty"`
|
||||
IsActive *string `json:"is_active,omitempty"`
|
||||
IsLogin *bool `json:"is_login,omitempty"`
|
||||
Token *string `json:"token,omitempty"`
|
||||
IDGoogleSignIn string `json:"id_google_sign_in"`
|
||||
DisplayNameGoogleSignIn *string `json:"display_name_google_sign_in,omitempty"`
|
||||
CreatedAt *string `json:"created_at,omitempty"`
|
||||
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"`
|
||||
}
|
||||
7
backend/graph/resolver/resolver.go
Normal file
7
backend/graph/resolver/resolver.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package resolver
|
||||
|
||||
// This file will not be regenerated automatically.
|
||||
//
|
||||
// It serves as dependency injection for your app, add any dependencies you require here.
|
||||
|
||||
type Resolver struct{}
|
||||
32
backend/graph/resolver/schema.resolvers.go
Normal file
32
backend/graph/resolver/schema.resolvers.go
Normal file
@@ -0,0 +1,32 @@
|
||||
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 }
|
||||
37
backend/graph/resolver/staff.resolvers.go
Normal file
37
backend/graph/resolver/staff.resolvers.go
Normal file
@@ -0,0 +1,37 @@
|
||||
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/model"
|
||||
)
|
||||
|
||||
// GenerateToken is the resolver for the generateToken field.
|
||||
func (r *mutationResolver) GenerateToken(ctx context.Context, email string, idGoogleSignIn string) (*model.TokenResponse, error) {
|
||||
panic(fmt.Errorf("not implemented: GenerateToken - generateToken"))
|
||||
}
|
||||
|
||||
// LoginAttendance is the resolver for the loginAttendance field.
|
||||
func (r *mutationResolver) LoginAttendance(ctx context.Context, email string, idGoogleSignIn string) (*model.Staff, error) {
|
||||
panic(fmt.Errorf("not implemented: LoginAttendance - loginAttendance"))
|
||||
}
|
||||
|
||||
// SearchStaffByEmail is the resolver for the searchStaffByEmail field.
|
||||
func (r *queryResolver) SearchStaffByEmail(ctx context.Context, email string) (*model.Staff, error) {
|
||||
panic(fmt.Errorf("not implemented: SearchStaffByEmail - searchStaffByEmail"))
|
||||
}
|
||||
|
||||
// StaffGetByStaffID is the resolver for the staffGetByStaffId field.
|
||||
func (r *queryResolver) StaffGetByStaffID(ctx context.Context, staffID string) (*model.Staff, error) {
|
||||
panic(fmt.Errorf("not implemented: StaffGetByStaffID - staffGetByStaffId"))
|
||||
}
|
||||
|
||||
// StaffListBySearch is the resolver for the staffListBySearch field.
|
||||
func (r *queryResolver) StaffListBySearch(ctx context.Context, search *string, page *int, maxPerPage *int) ([]*model.Staff, error) {
|
||||
panic(fmt.Errorf("not implemented: StaffListBySearch - staffListBySearch"))
|
||||
}
|
||||
Reference in New Issue
Block a user