diff --git a/api/graphql/department.graphqls b/api/graphql/department.graphqls new file mode 100644 index 0000000..6329319 --- /dev/null +++ b/api/graphql/department.graphqls @@ -0,0 +1,47 @@ +# Department types and inputs + +type Department { + id: ID! + name: String! + description: String! + managerId: ID + createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented +} + +type DepartmentConnection { + edges: [DepartmentEdge!]! + pageInfo: PageInfo! +} + +type DepartmentEdge { + node: Department! + cursor: String! +} + +input CreateDepartmentInput { + name: String! + description: String! + managerId: ID +} + +input UpdateDepartmentInput { + name: String + description: String + managerId: ID +} + +type CreateDepartmentPayload { + department: Department! + errors: [Error!] +} + +type UpdateDepartmentPayload { + department: Department! + errors: [Error!] +} + +type DeleteDepartmentPayload { + success: Boolean! + errors: [Error!] +} \ No newline at end of file diff --git a/api/graphql/leave.graphqls b/api/graphql/leave.graphqls new file mode 100644 index 0000000..53c276b --- /dev/null +++ b/api/graphql/leave.graphqls @@ -0,0 +1,74 @@ +# Leave types and inputs + +type Leave { + id: ID! + employeeId: ID! + leaveType: String! + startDate: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + endDate: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + reason: String! + status: String! + approvedBy: ID + approvedAt: String # TODO: Change to Time scalar when custom scalar marshaling is implemented + createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented +} + +type LeaveConnection { + edges: [LeaveEdge!]! + pageInfo: PageInfo! +} + +type LeaveEdge { + node: Leave! + cursor: String! +} + +input CreateLeaveInput { + employeeId: ID! + leaveType: String! + startDate: String! + endDate: String! + reason: String! +} + +input UpdateLeaveInput { + leaveType: String + startDate: String + endDate: String + reason: String +} + +input ApproveLeaveInput { + approvedBy: ID! +} + +type CreateLeavePayload { + leave: Leave! + errors: [Error!] +} + +type UpdateLeavePayload { + leave: Leave! + errors: [Error!] +} + +type ApproveLeavePayload { + leave: Leave! + errors: [Error!] +} + +type RejectLeavePayload { + leave: Leave! + errors: [Error!] +} + +type CancelLeavePayload { + leave: Leave! + errors: [Error!] +} + +type DeleteLeavePayload { + success: Boolean! + errors: [Error!] +} \ No newline at end of file diff --git a/api/graphql/mutation.graphqls b/api/graphql/mutation.graphqls index cedaf71..6ae9e2c 100644 --- a/api/graphql/mutation.graphqls +++ b/api/graphql/mutation.graphqls @@ -1,4 +1,4 @@ -# User and Employee mutations +# User, Employee, Department, Position, and Leave mutations type Mutation { createUser(input: CreateUserInput!): CreateUserPayload! @@ -7,4 +7,16 @@ type Mutation { createEmployee(input: CreateEmployeeInput!): CreateEmployeePayload! updateEmployee(id: ID!, input: UpdateEmployeeInput!): UpdateEmployeePayload! deleteEmployee(id: ID!): DeleteEmployeePayload! + createDepartment(input: CreateDepartmentInput!): CreateDepartmentPayload! + updateDepartment(id: ID!, input: UpdateDepartmentInput!): UpdateDepartmentPayload! + deleteDepartment(id: ID!): DeleteDepartmentPayload! + createPosition(input: CreatePositionInput!): CreatePositionPayload! + updatePosition(id: ID!, input: UpdatePositionInput!): UpdatePositionPayload! + deletePosition(id: ID!): DeletePositionPayload! + createLeave(input: CreateLeaveInput!): CreateLeavePayload! + updateLeave(id: ID!, input: UpdateLeaveInput!): UpdateLeavePayload! + approveLeave(id: ID!, input: ApproveLeaveInput!): ApproveLeavePayload! + rejectLeave(id: ID!, input: ApproveLeaveInput!): RejectLeavePayload! + cancelLeave(id: ID!): CancelLeavePayload! + deleteLeave(id: ID!): DeleteLeavePayload! } diff --git a/api/graphql/position.graphqls b/api/graphql/position.graphqls new file mode 100644 index 0000000..55e39d9 --- /dev/null +++ b/api/graphql/position.graphqls @@ -0,0 +1,56 @@ +# Position types and inputs + +type Position { + id: ID! + title: String! + description: String! + departmentId: ID + requirements: String! + minSalary: Float! + maxSalary: Float! + createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented +} + +type PositionConnection { + edges: [PositionEdge!]! + pageInfo: PageInfo! +} + +type PositionEdge { + node: Position! + cursor: String! +} + +input CreatePositionInput { + title: String! + description: String! + departmentId: ID + requirements: String! + minSalary: Float! + maxSalary: Float! +} + +input UpdatePositionInput { + title: String + description: String + departmentId: ID + requirements: String + minSalary: Float + maxSalary: Float +} + +type CreatePositionPayload { + position: Position! + errors: [Error!] +} + +type UpdatePositionPayload { + position: Position! + errors: [Error!] +} + +type DeletePositionPayload { + success: Boolean! + errors: [Error!] +} \ No newline at end of file diff --git a/api/graphql/query.graphqls b/api/graphql/query.graphqls index 2d46f9b..ff36110 100644 --- a/api/graphql/query.graphqls +++ b/api/graphql/query.graphqls @@ -1,4 +1,4 @@ -# User and Employee queries +# User, Employee, Department, Position, and Leave queries type Query { user(id: ID!): User @@ -7,4 +7,14 @@ type Query { employees(first: Int, after: String): EmployeeConnection! employeesByDepartment(department: String!, first: Int, after: String): EmployeeConnection! employeesByStatus(status: String!, first: Int, after: String): EmployeeConnection! + department(id: ID!): Department + departments(first: Int, after: String): DepartmentConnection! + departmentsByManager(managerId: ID!, first: Int, after: String): DepartmentConnection! + position(id: ID!): Position + positions(first: Int, after: String): PositionConnection! + positionsByDepartment(departmentId: ID!, first: Int, after: String): PositionConnection! + leave(id: ID!): Leave + leaves(first: Int, after: String): LeaveConnection! + leavesByEmployee(employeeId: ID!, first: Int, after: String): LeaveConnection! + leavesByStatus(status: String!, first: Int, after: String): LeaveConnection! } diff --git a/internal/application/department/dto.go b/internal/application/department/dto.go new file mode 100644 index 0000000..02d2517 --- /dev/null +++ b/internal/application/department/dto.go @@ -0,0 +1,102 @@ +package department + +import ( + "time" +) + +// DepartmentDTO represents a department data transfer object +type DepartmentDTO struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + ManagerID *string `json:"managerId,omitempty"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` +} + +// DepartmentConnectionDTO represents a paginated connection of departments +type DepartmentConnectionDTO struct { + Departments []*DepartmentDTO `json:"departments"` + NextCursor string `json:"nextCursor"` +} + +// GetDepartmentRequest represents a request to get a department by ID +type GetDepartmentRequest struct { + ID string `json:"id"` +} + +// GetDepartmentResponse represents a response for getting a department +type GetDepartmentResponse struct { + Department *DepartmentDTO `json:"department,omitempty"` + Errors []ErrorDTO `json:"errors,omitempty"` +} + +// ListDepartmentsRequest represents a request to list departments +type ListDepartmentsRequest struct { + Limit int `json:"limit"` + Cursor string `json:"cursor,omitempty"` +} + +// ListDepartmentsResponse represents a response for listing departments +type ListDepartmentsResponse struct { + Departments *DepartmentConnectionDTO `json:"departments,omitempty"` + Errors []ErrorDTO `json:"errors,omitempty"` +} + +// ListDepartmentsByManagerRequest represents a request to list departments by manager +type ListDepartmentsByManagerRequest struct { + ManagerID string `json:"managerId"` + Limit int `json:"limit"` + Cursor string `json:"cursor,omitempty"` +} + +// ListDepartmentsByManagerResponse represents a response for listing departments by manager +type ListDepartmentsByManagerResponse struct { + Departments *DepartmentConnectionDTO `json:"departments,omitempty"` + Errors []ErrorDTO `json:"errors,omitempty"` +} + +// CreateDepartmentRequest represents a request to create a department +type CreateDepartmentRequest struct { + Name string `json:"name"` + Description string `json:"description"` + ManagerID *string `json:"managerId,omitempty"` +} + +// CreateDepartmentResponse represents a response for creating a department +type CreateDepartmentResponse struct { + Department *DepartmentDTO `json:"department,omitempty"` + Errors []ErrorDTO `json:"errors,omitempty"` +} + +// UpdateDepartmentRequest represents a request to update a department +type UpdateDepartmentRequest struct { + ID string `json:"id"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + ManagerID *string `json:"managerId,omitempty"` +} + +// UpdateDepartmentResponse represents a response for updating a department +type UpdateDepartmentResponse struct { + Department *DepartmentDTO `json:"department,omitempty"` + Errors []ErrorDTO `json:"errors,omitempty"` +} + +// DeleteDepartmentRequest represents a request to delete a department +type DeleteDepartmentRequest struct { + ID string `json:"id"` +} + +// DeleteDepartmentResponse represents a response for deleting a department +type DeleteDepartmentResponse struct { + Success bool `json:"success"` + Errors []ErrorDTO `json:"errors,omitempty"` +} + +// ErrorDTO represents an error data transfer object +type ErrorDTO struct { + Message string `json:"message"` + Field string `json:"field,omitempty"` + Code string `json:"code,omitempty"` +} \ No newline at end of file diff --git a/internal/application/department/mapper.go b/internal/application/department/mapper.go new file mode 100644 index 0000000..421bf2f --- /dev/null +++ b/internal/application/department/mapper.go @@ -0,0 +1,78 @@ +package department + +import ( + "github.com/captain-corgi/go-graphql-example/internal/domain/department" + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" +) + +// mapDomainDepartmentToDTO converts a domain department to a DTO +func mapDomainDepartmentToDTO(domainDept *department.Department) *DepartmentDTO { + if domainDept == nil { + return nil + } + + dto := &DepartmentDTO{ + ID: domainDept.ID().String(), + Name: domainDept.Name().String(), + Description: domainDept.Description().String(), + CreatedAt: domainDept.CreatedAt(), + UpdatedAt: domainDept.UpdatedAt(), + } + + if domainDept.ManagerID() != nil { + managerID := domainDept.ManagerID().String() + dto.ManagerID = &managerID + } + + return dto +} + +// mapDomainDepartmentsToDTOs converts a slice of domain departments to DTOs +func mapDomainDepartmentsToDTOs(domainDepts []*department.Department) []*DepartmentDTO { + if domainDepts == nil { + return nil + } + + dtos := make([]*DepartmentDTO, len(domainDepts)) + for i, dept := range domainDepts { + dtos[i] = mapDomainDepartmentToDTO(dept) + } + + return dtos +} + +// mapDomainErrorToDTO converts a domain error to a DTO +func mapDomainErrorToDTO(err error) ErrorDTO { + if err == nil { + return ErrorDTO{} + } + + // Check if it's a domain error + if domainErr, ok := err.(errors.DomainError); ok { + return ErrorDTO{ + Message: domainErr.Message, + Field: domainErr.Field, + Code: domainErr.Code, + } + } + + // For other errors, return a generic error + return ErrorDTO{ + Message: err.Error(), + Code: "INTERNAL_ERROR", + } +} + +// mapDomainErrorsToDTOs converts a slice of domain errors to DTOs +func mapDomainErrorsToDTOs(errs []error) []ErrorDTO { + if errs == nil { + return nil + } + + dtos := make([]ErrorDTO, len(errs)) + for i, err := range errs { + dtos[i] = mapDomainErrorToDTO(err) + } + + return dtos +} \ No newline at end of file diff --git a/internal/application/department/service.go b/internal/application/department/service.go new file mode 100644 index 0000000..8ea3cca --- /dev/null +++ b/internal/application/department/service.go @@ -0,0 +1,448 @@ +package department + +import ( + "context" + "log/slog" + + "github.com/captain-corgi/go-graphql-example/internal/domain/department" + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" +) + +//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mocks/mock_$GOFILE -package=mocks + +// Service defines the interface for department application services +type Service interface { + // GetDepartment retrieves a department by ID + GetDepartment(ctx context.Context, req GetDepartmentRequest) (*GetDepartmentResponse, error) + + // ListDepartments retrieves a paginated list of departments + ListDepartments(ctx context.Context, req ListDepartmentsRequest) (*ListDepartmentsResponse, error) + + // ListDepartmentsByManager retrieves departments by manager ID + ListDepartmentsByManager(ctx context.Context, req ListDepartmentsByManagerRequest) (*ListDepartmentsByManagerResponse, error) + + // CreateDepartment creates a new department + CreateDepartment(ctx context.Context, req CreateDepartmentRequest) (*CreateDepartmentResponse, error) + + // UpdateDepartment updates an existing department + UpdateDepartment(ctx context.Context, req UpdateDepartmentRequest) (*UpdateDepartmentResponse, error) + + // DeleteDepartment deletes a department by ID + DeleteDepartment(ctx context.Context, req DeleteDepartmentRequest) (*DeleteDepartmentResponse, error) +} + +// service implements the Service interface +type service struct { + deptRepo department.Repository + deptService department.DomainService + logger *slog.Logger +} + +// NewService creates a new department service +func NewService(deptRepo department.Repository, deptService department.DomainService, logger *slog.Logger) Service { + return &service{ + deptRepo: deptRepo, + deptService: deptService, + logger: logger, + } +} + +// GetDepartment retrieves a department by ID +func (s *service) GetDepartment(ctx context.Context, req GetDepartmentRequest) (*GetDepartmentResponse, error) { + s.logger.InfoContext(ctx, "Getting department", "departmentID", req.ID) + + // Validate request + if err := s.validateGetDepartmentRequest(req); err != nil { + s.logger.WarnContext(ctx, "Invalid get department request", "error", err, "departmentID", req.ID) + return &GetDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Convert string ID to domain DepartmentID + deptID, err := department.NewDepartmentID(req.ID) + if err != nil { + s.logger.WarnContext(ctx, "Invalid department ID format", "error", err, "departmentID", req.ID) + return &GetDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Retrieve department from repository + domainDept, err := s.deptRepo.FindByID(ctx, deptID) + if err != nil { + s.logger.ErrorContext(ctx, "Failed to get department from repository", "error", err, "departmentID", req.ID) + return &GetDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + s.logger.InfoContext(ctx, "Successfully retrieved department", "departmentID", req.ID) + return &GetDepartmentResponse{ + Department: mapDomainDepartmentToDTO(domainDept), + }, nil +} + +// ListDepartments retrieves a paginated list of departments +func (s *service) ListDepartments(ctx context.Context, req ListDepartmentsRequest) (*ListDepartmentsResponse, error) { + s.logger.InfoContext(ctx, "Listing departments", "limit", req.Limit, "cursor", req.Cursor) + + // Validate request + if err := s.validateListDepartmentsRequest(req); err != nil { + s.logger.WarnContext(ctx, "Invalid list departments request", "error", err) + return &ListDepartmentsResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Set default limit if not provided + limit := req.Limit + if limit == 0 { + limit = 10 // Default page size + } + + // Retrieve departments from repository + domainDepts, nextCursor, err := s.deptRepo.FindAll(ctx, limit+1, req.Cursor) // +1 to check if there's a next page + if err != nil { + s.logger.ErrorContext(ctx, "Failed to list departments from repository", "error", err) + return &ListDepartmentsResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Check if there are more pages + hasNextPage := len(domainDepts) > limit + if hasNextPage { + domainDepts = domainDepts[:limit] // Remove the extra item + } + + s.logger.InfoContext(ctx, "Successfully listed departments", "count", len(domainDepts), "hasNextPage", hasNextPage) + return &ListDepartmentsResponse{ + Departments: &DepartmentConnectionDTO{ + Departments: mapDomainDepartmentsToDTOs(domainDepts), + NextCursor: nextCursor, + }, + }, nil +} + +// ListDepartmentsByManager retrieves departments by manager ID +func (s *service) ListDepartmentsByManager(ctx context.Context, req ListDepartmentsByManagerRequest) (*ListDepartmentsByManagerResponse, error) { + s.logger.InfoContext(ctx, "Listing departments by manager", "managerID", req.ManagerID, "limit", req.Limit, "cursor", req.Cursor) + + // Validate request + if err := s.validateListDepartmentsByManagerRequest(req); err != nil { + s.logger.WarnContext(ctx, "Invalid list departments by manager request", "error", err) + return &ListDepartmentsByManagerResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Convert string manager ID to domain EmployeeID + managerID, err := department.NewEmployeeID(req.ManagerID) + if err != nil { + s.logger.WarnContext(ctx, "Invalid manager ID format", "error", err, "managerID", req.ManagerID) + return &ListDepartmentsByManagerResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Set default limit if not provided + limit := req.Limit + if limit == 0 { + limit = 10 // Default page size + } + + // Retrieve departments from repository + domainDepts, nextCursor, err := s.deptRepo.FindByManager(ctx, managerID, limit+1, req.Cursor) // +1 to check if there's a next page + if err != nil { + s.logger.ErrorContext(ctx, "Failed to list departments by manager from repository", "error", err) + return &ListDepartmentsByManagerResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Check if there are more pages + hasNextPage := len(domainDepts) > limit + if hasNextPage { + domainDepts = domainDepts[:limit] // Remove the extra item + } + + s.logger.InfoContext(ctx, "Successfully listed departments by manager", "count", len(domainDepts), "hasNextPage", hasNextPage) + return &ListDepartmentsByManagerResponse{ + Departments: &DepartmentConnectionDTO{ + Departments: mapDomainDepartmentsToDTOs(domainDepts), + NextCursor: nextCursor, + }, + }, nil +} + +// CreateDepartment creates a new department +func (s *service) CreateDepartment(ctx context.Context, req CreateDepartmentRequest) (*CreateDepartmentResponse, error) { + s.logger.InfoContext(ctx, "Creating department", "name", req.Name) + + // Validate request + if err := s.validateCreateDepartmentRequest(req); err != nil { + s.logger.WarnContext(ctx, "Invalid create department request", "error", err) + return &CreateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Validate unique name + name, err := department.NewName(req.Name) + if err != nil { + s.logger.WarnContext(ctx, "Invalid department name", "error", err) + return &CreateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + if err := s.deptService.ValidateUniqueName(ctx, name, nil); err != nil { + s.logger.WarnContext(ctx, "Department name already exists", "error", err) + return &CreateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Create domain department + domainDept, err := department.NewDepartment(req.Name, req.Description, req.ManagerID) + if err != nil { + s.logger.WarnContext(ctx, "Failed to create domain department", "error", err) + return &CreateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Validate domain entity + if err := domainDept.Validate(); err != nil { + s.logger.WarnContext(ctx, "Invalid domain department", "error", err) + return &CreateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Save to repository + if err := s.deptRepo.Save(ctx, domainDept); err != nil { + s.logger.ErrorContext(ctx, "Failed to save department to repository", "error", err) + return &CreateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + s.logger.InfoContext(ctx, "Successfully created department", "departmentID", domainDept.ID().String()) + return &CreateDepartmentResponse{ + Department: mapDomainDepartmentToDTO(domainDept), + }, nil +} + +// UpdateDepartment updates an existing department +func (s *service) UpdateDepartment(ctx context.Context, req UpdateDepartmentRequest) (*UpdateDepartmentResponse, error) { + s.logger.InfoContext(ctx, "Updating department", "departmentID", req.ID) + + // Validate request + if err := s.validateUpdateDepartmentRequest(req); err != nil { + s.logger.WarnContext(ctx, "Invalid update department request", "error", err) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Convert string ID to domain DepartmentID + deptID, err := department.NewDepartmentID(req.ID) + if err != nil { + s.logger.WarnContext(ctx, "Invalid department ID format", "error", err, "departmentID", req.ID) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Retrieve existing department + domainDept, err := s.deptRepo.FindByID(ctx, deptID) + if err != nil { + s.logger.ErrorContext(ctx, "Failed to get department from repository", "error", err, "departmentID", req.ID) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Update fields if provided + if req.Name != nil { + if err := domainDept.UpdateName(*req.Name); err != nil { + s.logger.WarnContext(ctx, "Failed to update department name", "error", err) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + } + + if req.Description != nil { + if err := domainDept.UpdateDescription(*req.Description); err != nil { + s.logger.WarnContext(ctx, "Failed to update department description", "error", err) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + } + + if req.ManagerID != nil { + if err := domainDept.UpdateManager(req.ManagerID); err != nil { + s.logger.WarnContext(ctx, "Failed to update department manager", "error", err) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + } + + // Validate unique name if name was updated + if req.Name != nil { + name, err := department.NewName(*req.Name) + if err != nil { + s.logger.WarnContext(ctx, "Invalid department name", "error", err) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + if err := s.deptService.ValidateUniqueName(ctx, name, &deptID); err != nil { + s.logger.WarnContext(ctx, "Department name already exists", "error", err) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + } + + // Validate domain entity + if err := domainDept.Validate(); err != nil { + s.logger.WarnContext(ctx, "Invalid domain department", "error", err) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Save to repository + if err := s.deptRepo.Save(ctx, domainDept); err != nil { + s.logger.ErrorContext(ctx, "Failed to save department to repository", "error", err) + return &UpdateDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + s.logger.InfoContext(ctx, "Successfully updated department", "departmentID", req.ID) + return &UpdateDepartmentResponse{ + Department: mapDomainDepartmentToDTO(domainDept), + }, nil +} + +// DeleteDepartment deletes a department by ID +func (s *service) DeleteDepartment(ctx context.Context, req DeleteDepartmentRequest) (*DeleteDepartmentResponse, error) { + s.logger.InfoContext(ctx, "Deleting department", "departmentID", req.ID) + + // Validate request + if err := s.validateDeleteDepartmentRequest(req); err != nil { + s.logger.WarnContext(ctx, "Invalid delete department request", "error", err) + return &DeleteDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Convert string ID to domain DepartmentID + deptID, err := department.NewDepartmentID(req.ID) + if err != nil { + s.logger.WarnContext(ctx, "Invalid department ID format", "error", err, "departmentID", req.ID) + return &DeleteDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Check if department can be deleted + if err := s.deptService.CanDeleteDepartment(ctx, deptID); err != nil { + s.logger.WarnContext(ctx, "Department cannot be deleted", "error", err) + return &DeleteDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + // Delete from repository + if err := s.deptRepo.Delete(ctx, deptID); err != nil { + s.logger.ErrorContext(ctx, "Failed to delete department from repository", "error", err) + return &DeleteDepartmentResponse{ + Errors: []ErrorDTO{mapDomainErrorToDTO(err)}, + }, nil + } + + s.logger.InfoContext(ctx, "Successfully deleted department", "departmentID", req.ID) + return &DeleteDepartmentResponse{ + Success: true, + }, nil +} + +// Validation methods +func (s *service) validateGetDepartmentRequest(req GetDepartmentRequest) error { + if req.ID == "" { + return department.ValidateDepartmentID(req.ID) + } + return nil +} + +func (s *service) validateListDepartmentsRequest(req ListDepartmentsRequest) error { + if req.Limit < 0 { + return errors.DomainError{ + Message: "Limit cannot be negative", + Field: "limit", + Code: "INVALID_LIMIT", + } + } + return nil +} + +func (s *service) validateListDepartmentsByManagerRequest(req ListDepartmentsByManagerRequest) error { + if req.ManagerID == "" { + return errors.DomainError{ + Message: "Manager ID cannot be empty", + Field: "managerId", + Code: "INVALID_MANAGER_ID", + } + } + if req.Limit < 0 { + return errors.DomainError{ + Message: "Limit cannot be negative", + Field: "limit", + Code: "INVALID_LIMIT", + } + } + return nil +} + +func (s *service) validateCreateDepartmentRequest(req CreateDepartmentRequest) error { + if err := department.ValidateDepartmentName(req.Name); err != nil { + return err + } + if err := department.ValidateDepartmentDescription(req.Description); err != nil { + return err + } + return nil +} + +func (s *service) validateUpdateDepartmentRequest(req UpdateDepartmentRequest) error { + if req.ID == "" { + return department.ValidateDepartmentID(req.ID) + } + if req.Name != nil { + if err := department.ValidateDepartmentName(*req.Name); err != nil { + return err + } + } + if req.Description != nil { + if err := department.ValidateDepartmentDescription(*req.Description); err != nil { + return err + } + } + return nil +} + +func (s *service) validateDeleteDepartmentRequest(req DeleteDepartmentRequest) error { + if req.ID == "" { + return department.ValidateDepartmentID(req.ID) + } + return nil +} \ No newline at end of file diff --git a/internal/domain/department/department.go b/internal/domain/department/department.go new file mode 100644 index 0000000..48b3076 --- /dev/null +++ b/internal/domain/department/department.go @@ -0,0 +1,205 @@ +package department + +import ( + "time" + + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" +) + +// Department represents the department domain entity +type Department struct { + id DepartmentID + name Name + description Description + managerID *EmployeeID + createdAt time.Time + updatedAt time.Time +} + +// NewDepartment creates a new Department entity with validation +func NewDepartment(name, description string, managerID *string) (*Department, error) { + nameVO, err := NewName(name) + if err != nil { + return nil, err + } + + descriptionVO, err := NewDescription(description) + if err != nil { + return nil, err + } + + var managerIDVO *EmployeeID + if managerID != nil { + empID, err := NewEmployeeID(*managerID) + if err != nil { + return nil, err + } + managerIDVO = &empID + } + + now := time.Now() + + return &Department{ + id: GenerateDepartmentID(), + name: nameVO, + description: descriptionVO, + managerID: managerIDVO, + createdAt: now, + updatedAt: now, + }, nil +} + +// NewDepartmentWithID creates a Department entity with a specific ID (for reconstruction from persistence) +func NewDepartmentWithID(id, name, description string, managerID *string, createdAt, updatedAt time.Time) (*Department, error) { + deptID, err := NewDepartmentID(id) + if err != nil { + return nil, err + } + + nameVO, err := NewName(name) + if err != nil { + return nil, err + } + + descriptionVO, err := NewDescription(description) + if err != nil { + return nil, err + } + + var managerIDVO *EmployeeID + if managerID != nil { + empID, err := NewEmployeeID(*managerID) + if err != nil { + return nil, err + } + managerIDVO = &empID + } + + return &Department{ + id: deptID, + name: nameVO, + description: descriptionVO, + managerID: managerIDVO, + createdAt: createdAt, + updatedAt: updatedAt, + }, nil +} + +// ID returns the department's ID +func (d *Department) ID() DepartmentID { + return d.id +} + +// Name returns the department's name +func (d *Department) Name() Name { + return d.name +} + +// Description returns the department's description +func (d *Department) Description() Description { + return d.description +} + +// ManagerID returns the department's manager ID +func (d *Department) ManagerID() *EmployeeID { + return d.managerID +} + +// CreatedAt returns when the department was created +func (d *Department) CreatedAt() time.Time { + return d.createdAt +} + +// UpdatedAt returns when the department was last updated +func (d *Department) UpdatedAt() time.Time { + return d.updatedAt +} + +// UpdateName updates the department's name with validation +func (d *Department) UpdateName(name string) error { + nameVO, err := NewName(name) + if err != nil { + return err + } + + d.name = nameVO + d.updatedAt = time.Now() + return nil +} + +// UpdateDescription updates the department's description with validation +func (d *Department) UpdateDescription(description string) error { + descriptionVO, err := NewDescription(description) + if err != nil { + return err + } + + d.description = descriptionVO + d.updatedAt = time.Now() + return nil +} + +// UpdateManager updates the department's manager with validation +func (d *Department) UpdateManager(managerID *string) error { + var managerIDVO *EmployeeID + if managerID != nil { + empID, err := NewEmployeeID(*managerID) + if err != nil { + return err + } + managerIDVO = &empID + } + + d.managerID = managerIDVO + d.updatedAt = time.Now() + return nil +} + +// Validate performs comprehensive validation of the department entity +func (d *Department) Validate() error { + if d.id.String() == "" { + return errors.ErrInvalidDepartmentID + } + + if d.name.String() == "" { + return errors.ErrInvalidDepartmentName + } + + if d.description.String() == "" { + return errors.ErrInvalidDepartmentDescription + } + + if d.createdAt.IsZero() { + return errors.DomainError{ + Code: "INVALID_CREATED_AT", + Message: "Created at timestamp cannot be zero", + Field: "createdAt", + } + } + + if d.updatedAt.IsZero() { + return errors.DomainError{ + Code: "INVALID_UPDATED_AT", + Message: "Updated at timestamp cannot be zero", + Field: "updatedAt", + } + } + + if d.updatedAt.Before(d.createdAt) { + return errors.DomainError{ + Code: "INVALID_TIMESTAMPS", + Message: "Updated at cannot be before created at", + Field: "updatedAt", + } + } + + return nil +} + +// Equals checks if two departments are equal based on their ID +func (d *Department) Equals(other *Department) bool { + if other == nil { + return false + } + return d.id.Equals(other.id) +} \ No newline at end of file diff --git a/internal/domain/department/repository.go b/internal/domain/department/repository.go new file mode 100644 index 0000000..f277cf3 --- /dev/null +++ b/internal/domain/department/repository.go @@ -0,0 +1,34 @@ +package department + +import ( + "context" +) + +//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mocks/mock_$GOFILE -package=mocks + +// Repository defines the interface for department data access +type Repository interface { + // FindByID retrieves a department by its ID + FindByID(ctx context.Context, id DepartmentID) (*Department, error) + + // FindByName retrieves a department by its name + FindByName(ctx context.Context, name Name) (*Department, error) + + // FindAll retrieves departments with pagination support + FindAll(ctx context.Context, limit int, cursor string) ([]*Department, string, error) + + // FindByManager retrieves departments by manager ID + FindByManager(ctx context.Context, managerID EmployeeID, limit int, cursor string) ([]*Department, string, error) + + // Save persists a department (create or update) + Save(ctx context.Context, department *Department) error + + // Delete removes a department by ID + Delete(ctx context.Context, id DepartmentID) error + + // Exists checks if a department exists by ID + Exists(ctx context.Context, id DepartmentID) (bool, error) + + // ExistsByName checks if a department exists by name + ExistsByName(ctx context.Context, name Name, excludeID *DepartmentID) (bool, error) +} \ No newline at end of file diff --git a/internal/domain/department/service.go b/internal/domain/department/service.go new file mode 100644 index 0000000..9a9a667 --- /dev/null +++ b/internal/domain/department/service.go @@ -0,0 +1,83 @@ +package department + +import ( + "context" + + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" +) + +//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mocks/mock_$GOFILE -package=mocks + +// DomainService defines domain-specific business logic that doesn't belong to a single entity +type DomainService interface { + // ValidateUniqueName ensures department name uniqueness across the domain + ValidateUniqueName(ctx context.Context, name Name, excludeDepartmentID *DepartmentID) error + + // CanDeleteDepartment checks if a department can be safely deleted + CanDeleteDepartment(ctx context.Context, departmentID DepartmentID) error + + // ValidateManagerExists checks if the assigned manager exists and is valid + ValidateManagerExists(ctx context.Context, managerID *EmployeeID) error +} + +// domainService implements the DomainService interface +type domainService struct { + deptRepo Repository +} + +// NewDomainService creates a new domain service instance +func NewDomainService(deptRepo Repository) DomainService { + return &domainService{ + deptRepo: deptRepo, + } +} + +// ValidateUniqueName ensures department name uniqueness across the domain +func (s *domainService) ValidateUniqueName(ctx context.Context, name Name, excludeDepartmentID *DepartmentID) error { + existingDepartment, err := s.deptRepo.FindByName(ctx, name) + if err != nil { + // If department not found, name is unique + if err == errors.ErrDepartmentNotFound { + return nil + } + return err + } + + // If we're excluding a specific department ID (for updates), check if it's the same department + if excludeDepartmentID != nil && existingDepartment.ID().Equals(*excludeDepartmentID) { + return nil + } + + return errors.ErrDuplicateDepartmentName +} + +// CanDeleteDepartment checks if a department can be safely deleted +func (s *domainService) CanDeleteDepartment(ctx context.Context, departmentID DepartmentID) error { + // Check if department exists + _, err := s.deptRepo.FindByID(ctx, departmentID) + if err != nil { + return err + } + + // Add any business rules for deletion here + // For example: check if department has active employees, etc. + // For now, we allow all deletions + + return nil +} + +// ValidateManagerExists checks if the assigned manager exists and is valid +func (s *domainService) ValidateManagerExists(ctx context.Context, managerID *EmployeeID) error { + if managerID == nil { + // No manager assigned is valid + return nil + } + + // In a real implementation, you would check against the employee repository + // For now, we'll just validate the format + if managerID.String() == "" { + return errors.ErrInvalidEmployeeID + } + + return nil +} \ No newline at end of file diff --git a/internal/domain/department/value_objects.go b/internal/domain/department/value_objects.go new file mode 100644 index 0000000..cf26eac --- /dev/null +++ b/internal/domain/department/value_objects.go @@ -0,0 +1,222 @@ +package department + +import ( + "regexp" + "strings" + + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" + "github.com/google/uuid" +) + +// DepartmentID represents a department identifier +type DepartmentID struct { + value string +} + +// NewDepartmentID creates a new DepartmentID from a string +func NewDepartmentID(value string) (DepartmentID, error) { + if value == "" { + return DepartmentID{}, errors.ErrInvalidDepartmentID + } + + // Validate UUID format + if _, err := uuid.Parse(value); err != nil { + return DepartmentID{}, errors.ErrInvalidDepartmentID + } + + return DepartmentID{value: value}, nil +} + +// GenerateDepartmentID generates a new DepartmentID +func GenerateDepartmentID() DepartmentID { + return DepartmentID{value: uuid.New().String()} +} + +// String returns the string representation of the DepartmentID +func (d DepartmentID) String() string { + return d.value +} + +// Equals checks if two DepartmentIDs are equal +func (d DepartmentID) Equals(other DepartmentID) bool { + return d.value == other.value +} + +// Name represents a department name +type Name struct { + value string +} + +// NewName creates a new Name from a string +func NewName(value string) (Name, error) { + if value == "" { + return Name{}, errors.ErrInvalidDepartmentName + } + + trimmed := strings.TrimSpace(value) + if trimmed == "" { + return Name{}, errors.ErrInvalidDepartmentName + } + + if len(trimmed) > 100 { + return Name{}, errors.DomainError{ + Code: "DEPARTMENT_NAME_TOO_LONG", + Message: "Department name cannot exceed 100 characters", + Field: "name", + } + } + + // Check for valid characters (letters, numbers, spaces, hyphens, underscores) + validNameRegex := regexp.MustCompile(`^[a-zA-Z0-9\s\-_]+$`) + if !validNameRegex.MatchString(trimmed) { + return Name{}, errors.DomainError{ + Code: "INVALID_DEPARTMENT_NAME_CHARACTERS", + Message: "Department name can only contain letters, numbers, spaces, hyphens, and underscores", + Field: "name", + } + } + + return Name{value: trimmed}, nil +} + +// String returns the string representation of the Name +func (n Name) String() string { + return n.value +} + +// Equals checks if two Names are equal +func (n Name) Equals(other Name) bool { + return n.value == other.value +} + +// Description represents a department description +type Description struct { + value string +} + +// NewDescription creates a new Description from a string +func NewDescription(value string) (Description, error) { + if value == "" { + return Description{}, errors.ErrInvalidDepartmentDescription + } + + trimmed := strings.TrimSpace(value) + if trimmed == "" { + return Description{}, errors.ErrInvalidDepartmentDescription + } + + if len(trimmed) > 500 { + return Description{}, errors.DomainError{ + Code: "DEPARTMENT_DESCRIPTION_TOO_LONG", + Message: "Department description cannot exceed 500 characters", + Field: "description", + } + } + + return Description{value: trimmed}, nil +} + +// String returns the string representation of the Description +func (d Description) String() string { + return d.value +} + +// Equals checks if two Descriptions are equal +func (d Description) Equals(other Description) bool { + return d.value == other.value +} + +// EmployeeID represents an employee identifier (reused from employee domain) +type EmployeeID struct { + value string +} + +// NewEmployeeID creates a new EmployeeID from a string +func NewEmployeeID(value string) (EmployeeID, error) { + if value == "" { + return EmployeeID{}, errors.ErrInvalidEmployeeID + } + + // Validate UUID format + if _, err := uuid.Parse(value); err != nil { + return EmployeeID{}, errors.ErrInvalidEmployeeID + } + + return EmployeeID{value: value}, nil +} + +// String returns the string representation of the EmployeeID +func (e EmployeeID) String() string { + return e.value +} + +// Equals checks if two EmployeeIDs are equal +func (e EmployeeID) Equals(other EmployeeID) bool { + return e.value == other.value +} + +// ValidateDepartmentID validates a department ID string +func ValidateDepartmentID(id string) error { + if id == "" { + return errors.ErrInvalidDepartmentID + } + + if _, err := uuid.Parse(id); err != nil { + return errors.ErrInvalidDepartmentID + } + + return nil +} + +// ValidateDepartmentName validates a department name string +func ValidateDepartmentName(name string) error { + if name == "" { + return errors.ErrInvalidDepartmentName + } + + trimmed := strings.TrimSpace(name) + if trimmed == "" { + return errors.ErrInvalidDepartmentName + } + + if len(trimmed) > 100 { + return errors.DomainError{ + Code: "DEPARTMENT_NAME_TOO_LONG", + Message: "Department name cannot exceed 100 characters", + Field: "name", + } + } + + validNameRegex := regexp.MustCompile(`^[a-zA-Z0-9\s\-_]+$`) + if !validNameRegex.MatchString(trimmed) { + return errors.DomainError{ + Code: "INVALID_DEPARTMENT_NAME_CHARACTERS", + Message: "Department name can only contain letters, numbers, spaces, hyphens, and underscores", + Field: "name", + } + } + + return nil +} + +// ValidateDepartmentDescription validates a department description string +func ValidateDepartmentDescription(description string) error { + if description == "" { + return errors.ErrInvalidDepartmentDescription + } + + trimmed := strings.TrimSpace(description) + if trimmed == "" { + return errors.ErrInvalidDepartmentDescription + } + + if len(trimmed) > 500 { + return errors.DomainError{ + Code: "DEPARTMENT_DESCRIPTION_TOO_LONG", + Message: "Department description cannot exceed 500 characters", + Field: "description", + } + } + + return nil +} \ No newline at end of file diff --git a/internal/domain/errors/errors.go b/internal/domain/errors/errors.go index 94641e9..fc56182 100644 --- a/internal/domain/errors/errors.go +++ b/internal/domain/errors/errors.go @@ -39,6 +39,37 @@ var ( ErrEmployeeAlreadyExists = DomainError{Code: "EMPLOYEE_ALREADY_EXISTS", Message: "Employee already exists"} ) +// Department domain errors +var ( + ErrDepartmentNotFound = DomainError{Code: "DEPARTMENT_NOT_FOUND", Message: "Department not found"} + ErrInvalidDepartmentID = DomainError{Code: "INVALID_DEPARTMENT_ID", Message: "Invalid department ID format", Field: "id"} + ErrInvalidDepartmentName = DomainError{Code: "INVALID_DEPARTMENT_NAME", Message: "Department name cannot be empty", Field: "name"} + ErrDuplicateDepartmentName = DomainError{Code: "DUPLICATE_DEPARTMENT_NAME", Message: "Department name already exists", Field: "name"} + ErrInvalidDepartmentDescription = DomainError{Code: "INVALID_DEPARTMENT_DESCRIPTION", Message: "Department description cannot be empty", Field: "description"} + ErrDepartmentAlreadyExists = DomainError{Code: "DEPARTMENT_ALREADY_EXISTS", Message: "Department already exists"} +) + +// Position domain errors +var ( + ErrPositionNotFound = DomainError{Code: "POSITION_NOT_FOUND", Message: "Position not found"} + ErrInvalidPositionID = DomainError{Code: "INVALID_POSITION_ID", Message: "Invalid position ID format", Field: "id"} + ErrInvalidPositionTitle = DomainError{Code: "INVALID_POSITION_TITLE", Message: "Position title cannot be empty", Field: "title"} + ErrDuplicatePositionTitle = DomainError{Code: "DUPLICATE_POSITION_TITLE", Message: "Position title already exists", Field: "title"} + ErrInvalidPositionDescription = DomainError{Code: "INVALID_POSITION_DESCRIPTION", Message: "Position description cannot be empty", Field: "description"} + ErrInvalidPositionRequirements = DomainError{Code: "INVALID_POSITION_REQUIREMENTS", Message: "Position requirements cannot be empty", Field: "requirements"} + ErrPositionAlreadyExists = DomainError{Code: "POSITION_ALREADY_EXISTS", Message: "Position already exists"} +) + +// Leave domain errors +var ( + ErrLeaveNotFound = DomainError{Code: "LEAVE_NOT_FOUND", Message: "Leave request not found"} + ErrInvalidLeaveID = DomainError{Code: "INVALID_LEAVE_ID", Message: "Invalid leave ID format", Field: "id"} + ErrInvalidLeaveType = DomainError{Code: "INVALID_LEAVE_TYPE", Message: "Invalid leave type", Field: "leaveType"} + ErrInvalidLeaveStatus = DomainError{Code: "INVALID_LEAVE_STATUS", Message: "Invalid leave status", Field: "status"} + ErrInvalidLeaveReason = DomainError{Code: "INVALID_LEAVE_REASON", Message: "Leave reason cannot be empty", Field: "reason"} + ErrLeaveAlreadyExists = DomainError{Code: "LEAVE_ALREADY_EXISTS", Message: "Leave request already exists"} +) + // Repository errors var ( ErrRepositoryConnection = DomainError{Code: "REPOSITORY_CONNECTION", Message: "Repository connection failed"} diff --git a/internal/domain/leave/leave.go b/internal/domain/leave/leave.go new file mode 100644 index 0000000..4c4f8d7 --- /dev/null +++ b/internal/domain/leave/leave.go @@ -0,0 +1,406 @@ +package leave + +import ( + "time" + + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" +) + +// Leave represents the leave request domain entity +type Leave struct { + id LeaveID + employeeID EmployeeID + leaveType LeaveType + startDate time.Time + endDate time.Time + reason Reason + status Status + approvedBy *EmployeeID + approvedAt *time.Time + createdAt time.Time + updatedAt time.Time +} + +// NewLeave creates a new Leave entity with validation +func NewLeave(employeeID string, leaveType string, startDate, endDate time.Time, reason string) (*Leave, error) { + empID, err := NewEmployeeID(employeeID) + if err != nil { + return nil, err + } + + leaveTypeVO, err := NewLeaveType(leaveType) + if err != nil { + return nil, err + } + + reasonVO, err := NewReason(reason) + if err != nil { + return nil, err + } + + // Validate dates + if startDate.IsZero() { + return nil, errors.DomainError{ + Code: "INVALID_START_DATE", + Message: "Start date cannot be zero", + Field: "startDate", + } + } + + if endDate.IsZero() { + return nil, errors.DomainError{ + Code: "INVALID_END_DATE", + Message: "End date cannot be zero", + Field: "endDate", + } + } + + if startDate.After(endDate) { + return nil, errors.DomainError{ + Code: "INVALID_DATE_RANGE", + Message: "Start date cannot be after end date", + Field: "startDate", + } + } + + if startDate.Before(time.Now().Truncate(24 * time.Hour)) { + return nil, errors.DomainError{ + Code: "INVALID_START_DATE", + Message: "Start date cannot be in the past", + Field: "startDate", + } + } + + now := time.Now() + + return &Leave{ + id: GenerateLeaveID(), + employeeID: empID, + leaveType: leaveTypeVO, + startDate: startDate, + endDate: endDate, + reason: reasonVO, + status: Status{value: StatusPending}, + createdAt: now, + updatedAt: now, + }, nil +} + +// NewLeaveWithID creates a Leave entity with a specific ID (for reconstruction from persistence) +func NewLeaveWithID(id, employeeID, leaveType, reason string, startDate, endDate time.Time, status string, approvedBy *string, approvedAt *time.Time, createdAt, updatedAt time.Time) (*Leave, error) { + leaveID, err := NewLeaveID(id) + if err != nil { + return nil, err + } + + empID, err := NewEmployeeID(employeeID) + if err != nil { + return nil, err + } + + leaveTypeVO, err := NewLeaveType(leaveType) + if err != nil { + return nil, err + } + + reasonVO, err := NewReason(reason) + if err != nil { + return nil, err + } + + statusVO, err := NewStatus(status) + if err != nil { + return nil, err + } + + var approvedByVO *EmployeeID + if approvedBy != nil { + empID, err := NewEmployeeID(*approvedBy) + if err != nil { + return nil, err + } + approvedByVO = &empID + } + + return &Leave{ + id: leaveID, + employeeID: empID, + leaveType: leaveTypeVO, + startDate: startDate, + endDate: endDate, + reason: reasonVO, + status: statusVO, + approvedBy: approvedByVO, + approvedAt: approvedAt, + createdAt: createdAt, + updatedAt: updatedAt, + }, nil +} + +// ID returns the leave's ID +func (l *Leave) ID() LeaveID { + return l.id +} + +// EmployeeID returns the leave's employee ID +func (l *Leave) EmployeeID() EmployeeID { + return l.employeeID +} + +// LeaveType returns the leave's type +func (l *Leave) LeaveType() LeaveType { + return l.leaveType +} + +// StartDate returns the leave's start date +func (l *Leave) StartDate() time.Time { + return l.startDate +} + +// EndDate returns the leave's end date +func (l *Leave) EndDate() time.Time { + return l.endDate +} + +// Reason returns the leave's reason +func (l *Leave) Reason() Reason { + return l.reason +} + +// Status returns the leave's status +func (l *Leave) Status() Status { + return l.status +} + +// ApprovedBy returns the leave's approver ID +func (l *Leave) ApprovedBy() *EmployeeID { + return l.approvedBy +} + +// ApprovedAt returns when the leave was approved +func (l *Leave) ApprovedAt() *time.Time { + return l.approvedAt +} + +// CreatedAt returns when the leave was created +func (l *Leave) CreatedAt() time.Time { + return l.createdAt +} + +// UpdatedAt returns when the leave was last updated +func (l *Leave) UpdatedAt() time.Time { + return l.updatedAt +} + +// Approve approves the leave request +func (l *Leave) Approve(approvedBy string) error { + approvedByVO, err := NewEmployeeID(approvedBy) + if err != nil { + return err + } + + if !l.status.IsPending() { + return errors.DomainError{ + Code: "INVALID_STATUS_TRANSITION", + Message: "Only pending leave requests can be approved", + Field: "status", + } + } + + approvedStatus, _ := NewStatus(StatusApproved) + l.status = approvedStatus + l.approvedBy = &approvedByVO + now := time.Now() + l.approvedAt = &now + l.updatedAt = now + return nil +} + +// Reject rejects the leave request +func (l *Leave) Reject(approvedBy string) error { + approvedByVO, err := NewEmployeeID(approvedBy) + if err != nil { + return err + } + + if !l.status.IsPending() { + return errors.DomainError{ + Code: "INVALID_STATUS_TRANSITION", + Message: "Only pending leave requests can be rejected", + Field: "status", + } + } + + rejectedStatus, _ := NewStatus(StatusRejected) + l.status = rejectedStatus + l.approvedBy = &approvedByVO + now := time.Now() + l.approvedAt = &now + l.updatedAt = now + return nil +} + +// Cancel cancels the leave request +func (l *Leave) Cancel() error { + if !l.status.IsPending() && !l.status.IsApproved() { + return errors.DomainError{ + Code: "INVALID_STATUS_TRANSITION", + Message: "Only pending or approved leave requests can be cancelled", + Field: "status", + } + } + + cancelledStatus, _ := NewStatus(StatusCancelled) + l.status = cancelledStatus + l.updatedAt = time.Now() + return nil +} + +// UpdateReason updates the leave's reason with validation +func (l *Leave) UpdateReason(reason string) error { + if !l.status.IsPending() { + return errors.DomainError{ + Code: "INVALID_UPDATE", + Message: "Cannot update reason for non-pending leave requests", + Field: "reason", + } + } + + reasonVO, err := NewReason(reason) + if err != nil { + return err + } + + l.reason = reasonVO + l.updatedAt = time.Now() + return nil +} + +// UpdateDates updates the leave's dates with validation +func (l *Leave) UpdateDates(startDate, endDate time.Time) error { + if !l.status.IsPending() { + return errors.DomainError{ + Code: "INVALID_UPDATE", + Message: "Cannot update dates for non-pending leave requests", + Field: "dates", + } + } + + if startDate.IsZero() { + return errors.DomainError{ + Code: "INVALID_START_DATE", + Message: "Start date cannot be zero", + Field: "startDate", + } + } + + if endDate.IsZero() { + return errors.DomainError{ + Code: "INVALID_END_DATE", + Message: "End date cannot be zero", + Field: "endDate", + } + } + + if startDate.After(endDate) { + return errors.DomainError{ + Code: "INVALID_DATE_RANGE", + Message: "Start date cannot be after end date", + Field: "startDate", + } + } + + if startDate.Before(time.Now().Truncate(24 * time.Hour)) { + return errors.DomainError{ + Code: "INVALID_START_DATE", + Message: "Start date cannot be in the past", + Field: "startDate", + } + } + + l.startDate = startDate + l.endDate = endDate + l.updatedAt = time.Now() + return nil +} + +// Validate performs comprehensive validation of the leave entity +func (l *Leave) Validate() error { + if l.id.String() == "" { + return errors.ErrInvalidLeaveID + } + + if l.employeeID.String() == "" { + return errors.ErrInvalidEmployeeID + } + + if l.leaveType.String() == "" { + return errors.ErrInvalidLeaveType + } + + if l.reason.String() == "" { + return errors.ErrInvalidLeaveReason + } + + if l.status.String() == "" { + return errors.ErrInvalidLeaveStatus + } + + if l.startDate.IsZero() { + return errors.DomainError{ + Code: "INVALID_START_DATE", + Message: "Start date cannot be zero", + Field: "startDate", + } + } + + if l.endDate.IsZero() { + return errors.DomainError{ + Code: "INVALID_END_DATE", + Message: "End date cannot be zero", + Field: "endDate", + } + } + + if l.startDate.After(l.endDate) { + return errors.DomainError{ + Code: "INVALID_DATE_RANGE", + Message: "Start date cannot be after end date", + Field: "startDate", + } + } + + if l.createdAt.IsZero() { + return errors.DomainError{ + Code: "INVALID_CREATED_AT", + Message: "Created at timestamp cannot be zero", + Field: "createdAt", + } + } + + if l.updatedAt.IsZero() { + return errors.DomainError{ + Code: "INVALID_UPDATED_AT", + Message: "Updated at timestamp cannot be zero", + Field: "updatedAt", + } + } + + if l.updatedAt.Before(l.createdAt) { + return errors.DomainError{ + Code: "INVALID_TIMESTAMPS", + Message: "Updated at cannot be before created at", + Field: "updatedAt", + } + } + + return nil +} + +// Equals checks if two leaves are equal based on their ID +func (l *Leave) Equals(other *Leave) bool { + if other == nil { + return false + } + return l.id.Equals(other.id) +} \ No newline at end of file diff --git a/internal/domain/leave/repository.go b/internal/domain/leave/repository.go new file mode 100644 index 0000000..3a77916 --- /dev/null +++ b/internal/domain/leave/repository.go @@ -0,0 +1,38 @@ +package leave + +import ( + "context" + "time" +) + +//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mocks/mock_$GOFILE -package=mocks + +// Repository defines the interface for leave data access +type Repository interface { + // FindByID retrieves a leave request by its ID + FindByID(ctx context.Context, id LeaveID) (*Leave, error) + + // FindByEmployee retrieves leave requests by employee ID + FindByEmployee(ctx context.Context, employeeID EmployeeID, limit int, cursor string) ([]*Leave, string, error) + + // FindByStatus retrieves leave requests by status + FindByStatus(ctx context.Context, status Status, limit int, cursor string) ([]*Leave, string, error) + + // FindByDateRange retrieves leave requests within a date range + FindByDateRange(ctx context.Context, startDate, endDate time.Time, limit int, cursor string) ([]*Leave, string, error) + + // FindAll retrieves leave requests with pagination support + FindAll(ctx context.Context, limit int, cursor string) ([]*Leave, string, error) + + // Save persists a leave request (create or update) + Save(ctx context.Context, leave *Leave) error + + // Delete removes a leave request by ID + Delete(ctx context.Context, id LeaveID) error + + // Exists checks if a leave request exists by ID + Exists(ctx context.Context, id LeaveID) (bool, error) + + // CountByEmployeeAndDateRange counts leave requests for an employee within a date range + CountByEmployeeAndDateRange(ctx context.Context, employeeID EmployeeID, startDate, endDate time.Time) (int, error) +} \ No newline at end of file diff --git a/internal/domain/leave/service.go b/internal/domain/leave/service.go new file mode 100644 index 0000000..23c7371 --- /dev/null +++ b/internal/domain/leave/service.go @@ -0,0 +1,119 @@ +package leave + +import ( + "context" + "time" + + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" +) + +//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mocks/mock_$GOFILE -package=mocks + +// DomainService defines domain-specific business logic that doesn't belong to a single entity +type DomainService interface { + // ValidateEmployeeExists checks if the employee exists and is valid + ValidateEmployeeExists(ctx context.Context, employeeID EmployeeID) error + + // ValidateApproverExists checks if the approver exists and is valid + ValidateApproverExists(ctx context.Context, approverID EmployeeID) error + + // CanDeleteLeave checks if a leave request can be safely deleted + CanDeleteLeave(ctx context.Context, leaveID LeaveID) error + + // ValidateNoOverlappingLeaves checks if there are no overlapping leave requests + ValidateNoOverlappingLeaves(ctx context.Context, employeeID EmployeeID, startDate, endDate time.Time, excludeLeaveID *LeaveID) error +} + +// domainService implements the DomainService interface +type domainService struct { + leaveRepo Repository +} + +// NewDomainService creates a new domain service instance +func NewDomainService(leaveRepo Repository) DomainService { + return &domainService{ + leaveRepo: leaveRepo, + } +} + +// ValidateEmployeeExists checks if the employee exists and is valid +func (s *domainService) ValidateEmployeeExists(ctx context.Context, employeeID EmployeeID) error { + // In a real implementation, you would check against the employee repository + // For now, we'll just validate the format + if employeeID.String() == "" { + return errors.ErrInvalidEmployeeID + } + + return nil +} + +// ValidateApproverExists checks if the approver exists and is valid +func (s *domainService) ValidateApproverExists(ctx context.Context, approverID EmployeeID) error { + // In a real implementation, you would check against the employee repository + // and verify the approver has appropriate permissions + // For now, we'll just validate the format + if approverID.String() == "" { + return errors.ErrInvalidEmployeeID + } + + return nil +} + +// CanDeleteLeave checks if a leave request can be safely deleted +func (s *domainService) CanDeleteLeave(ctx context.Context, leaveID LeaveID) error { + // Check if leave exists + leave, err := s.leaveRepo.FindByID(ctx, leaveID) + if err != nil { + return err + } + + // Only allow deletion of pending or cancelled leave requests + if !leave.Status().IsPending() && !leave.Status().IsCancelled() { + return errors.DomainError{ + Code: "INVALID_DELETE_OPERATION", + Message: "Cannot delete approved or rejected leave requests", + Field: "status", + } + } + + return nil +} + +// ValidateNoOverlappingLeaves checks if there are no overlapping leave requests +func (s *domainService) ValidateNoOverlappingLeaves(ctx context.Context, employeeID EmployeeID, startDate, endDate time.Time, excludeLeaveID *LeaveID) error { + // Get all leave requests for the employee in the date range + leaves, _, err := s.leaveRepo.FindByDateRange(ctx, startDate, endDate, 100, "") + if err != nil { + return err + } + + // Check for overlapping leaves + for _, leave := range leaves { + // Skip the leave we're updating (if any) + if excludeLeaveID != nil && leave.ID().Equals(*excludeLeaveID) { + continue + } + + // Skip leaves for different employees + if !leave.EmployeeID().Equals(employeeID) { + continue + } + + // Skip cancelled leaves + if leave.Status().IsCancelled() { + continue + } + + // Check for overlap + if (startDate.Before(leave.EndDate()) || startDate.Equal(leave.EndDate())) && + (endDate.After(leave.StartDate()) || endDate.Equal(leave.StartDate())) { + return errors.DomainError{ + Code: "OVERLAPPING_LEAVE", + Message: "Leave request overlaps with existing approved or pending leave", + Field: "dateRange", + } + } + } + + return nil +} \ No newline at end of file diff --git a/internal/domain/leave/value_objects.go b/internal/domain/leave/value_objects.go new file mode 100644 index 0000000..ee67494 --- /dev/null +++ b/internal/domain/leave/value_objects.go @@ -0,0 +1,289 @@ +package leave + +import ( + "strings" + + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" + "github.com/google/uuid" +) + +// LeaveID represents a leave identifier +type LeaveID struct { + value string +} + +// NewLeaveID creates a new LeaveID from a string +func NewLeaveID(value string) (LeaveID, error) { + if value == "" { + return LeaveID{}, errors.ErrInvalidLeaveID + } + + // Validate UUID format + if _, err := uuid.Parse(value); err != nil { + return LeaveID{}, errors.ErrInvalidLeaveID + } + + return LeaveID{value: value}, nil +} + +// GenerateLeaveID generates a new LeaveID +func GenerateLeaveID() LeaveID { + return LeaveID{value: uuid.New().String()} +} + +// String returns the string representation of the LeaveID +func (l LeaveID) String() string { + return l.value +} + +// Equals checks if two LeaveIDs are equal +func (l LeaveID) Equals(other LeaveID) bool { + return l.value == other.value +} + +// LeaveType represents the type of leave +type LeaveType struct { + value string +} + +// Predefined leave types +const ( + LeaveTypeVacation = "VACATION" + LeaveTypeSick = "SICK" + LeaveTypePersonal = "PERSONAL" + LeaveTypeMaternity = "MATERNITY" + LeaveTypePaternity = "PATERNITY" + LeaveTypeBereavement = "BEREAVEMENT" + LeaveTypeUnpaid = "UNPAID" + LeaveTypeOther = "OTHER" +) + +// Valid leave types +var validLeaveTypes = map[string]bool{ + LeaveTypeVacation: true, + LeaveTypeSick: true, + LeaveTypePersonal: true, + LeaveTypeMaternity: true, + LeaveTypePaternity: true, + LeaveTypeBereavement: true, + LeaveTypeUnpaid: true, + LeaveTypeOther: true, +} + +// NewLeaveType creates a new LeaveType from a string +func NewLeaveType(value string) (LeaveType, error) { + if value == "" { + return LeaveType{}, errors.ErrInvalidLeaveType + } + + upperValue := strings.ToUpper(strings.TrimSpace(value)) + if !validLeaveTypes[upperValue] { + return LeaveType{}, errors.ErrInvalidLeaveType + } + + return LeaveType{value: upperValue}, nil +} + +// String returns the string representation of the LeaveType +func (l LeaveType) String() string { + return l.value +} + +// Equals checks if two LeaveTypes are equal +func (l LeaveType) Equals(other LeaveType) bool { + return l.value == other.value +} + +// Status represents the status of a leave request +type Status struct { + value string +} + +// Predefined status values +const ( + StatusPending = "PENDING" + StatusApproved = "APPROVED" + StatusRejected = "REJECTED" + StatusCancelled = "CANCELLED" +) + +// Valid status values +var validStatuses = map[string]bool{ + StatusPending: true, + StatusApproved: true, + StatusRejected: true, + StatusCancelled: true, +} + +// NewStatus creates a new Status from a string +func NewStatus(value string) (Status, error) { + if value == "" { + return Status{}, errors.ErrInvalidLeaveStatus + } + + upperValue := strings.ToUpper(strings.TrimSpace(value)) + if !validStatuses[upperValue] { + return Status{}, errors.ErrInvalidLeaveStatus + } + + return Status{value: upperValue}, nil +} + +// String returns the string representation of the Status +func (s Status) String() string { + return s.value +} + +// Equals checks if two Statuses are equal +func (s Status) Equals(other Status) bool { + return s.value == other.value +} + +// IsPending checks if the status is pending +func (s Status) IsPending() bool { + return s.value == StatusPending +} + +// IsApproved checks if the status is approved +func (s Status) IsApproved() bool { + return s.value == StatusApproved +} + +// IsRejected checks if the status is rejected +func (s Status) IsRejected() bool { + return s.value == StatusRejected +} + +// IsCancelled checks if the status is cancelled +func (s Status) IsCancelled() bool { + return s.value == StatusCancelled +} + +// Reason represents the reason for leave +type Reason struct { + value string +} + +// NewReason creates a new Reason from a string +func NewReason(value string) (Reason, error) { + if value == "" { + return Reason{}, errors.ErrInvalidLeaveReason + } + + trimmed := strings.TrimSpace(value) + if trimmed == "" { + return Reason{}, errors.ErrInvalidLeaveReason + } + + if len(trimmed) > 500 { + return Reason{}, errors.DomainError{ + Code: "LEAVE_REASON_TOO_LONG", + Message: "Leave reason cannot exceed 500 characters", + Field: "reason", + } + } + + return Reason{value: trimmed}, nil +} + +// String returns the string representation of the Reason +func (r Reason) String() string { + return r.value +} + +// Equals checks if two Reasons are equal +func (r Reason) Equals(other Reason) bool { + return r.value == other.value +} + +// EmployeeID represents an employee identifier (reused from employee domain) +type EmployeeID struct { + value string +} + +// NewEmployeeID creates a new EmployeeID from a string +func NewEmployeeID(value string) (EmployeeID, error) { + if value == "" { + return EmployeeID{}, errors.ErrInvalidEmployeeID + } + + // Validate UUID format + if _, err := uuid.Parse(value); err != nil { + return EmployeeID{}, errors.ErrInvalidEmployeeID + } + + return EmployeeID{value: value}, nil +} + +// String returns the string representation of the EmployeeID +func (e EmployeeID) String() string { + return e.value +} + +// Equals checks if two EmployeeIDs are equal +func (e EmployeeID) Equals(other EmployeeID) bool { + return e.value == other.value +} + +// ValidateLeaveID validates a leave ID string +func ValidateLeaveID(id string) error { + if id == "" { + return errors.ErrInvalidLeaveID + } + + if _, err := uuid.Parse(id); err != nil { + return errors.ErrInvalidLeaveID + } + + return nil +} + +// ValidateLeaveType validates a leave type string +func ValidateLeaveType(leaveType string) error { + if leaveType == "" { + return errors.ErrInvalidLeaveType + } + + upperValue := strings.ToUpper(strings.TrimSpace(leaveType)) + if !validLeaveTypes[upperValue] { + return errors.ErrInvalidLeaveType + } + + return nil +} + +// ValidateLeaveStatus validates a leave status string +func ValidateLeaveStatus(status string) error { + if status == "" { + return errors.ErrInvalidLeaveStatus + } + + upperValue := strings.ToUpper(strings.TrimSpace(status)) + if !validStatuses[upperValue] { + return errors.ErrInvalidLeaveStatus + } + + return nil +} + +// ValidateLeaveReason validates a leave reason string +func ValidateLeaveReason(reason string) error { + if reason == "" { + return errors.ErrInvalidLeaveReason + } + + trimmed := strings.TrimSpace(reason) + if trimmed == "" { + return errors.ErrInvalidLeaveReason + } + + if len(trimmed) > 500 { + return errors.DomainError{ + Code: "LEAVE_REASON_TOO_LONG", + Message: "Leave reason cannot exceed 500 characters", + Field: "reason", + } + } + + return nil +} \ No newline at end of file diff --git a/internal/domain/position/position.go b/internal/domain/position/position.go new file mode 100644 index 0000000..b50d606 --- /dev/null +++ b/internal/domain/position/position.go @@ -0,0 +1,269 @@ +package position + +import ( + "time" + + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" +) + +// Position represents the position/job domain entity +type Position struct { + id PositionID + title Title + description Description + departmentID *DepartmentID + requirements Requirements + salaryRange SalaryRange + createdAt time.Time + updatedAt time.Time +} + +// NewPosition creates a new Position entity with validation +func NewPosition(title, description, requirements string, departmentID *string, minSalary, maxSalary float64) (*Position, error) { + titleVO, err := NewTitle(title) + if err != nil { + return nil, err + } + + descriptionVO, err := NewDescription(description) + if err != nil { + return nil, err + } + + requirementsVO, err := NewRequirements(requirements) + if err != nil { + return nil, err + } + + var deptIDVO *DepartmentID + if departmentID != nil { + deptID, err := NewDepartmentID(*departmentID) + if err != nil { + return nil, err + } + deptIDVO = &deptID + } + + salaryRangeVO, err := NewSalaryRange(minSalary, maxSalary) + if err != nil { + return nil, err + } + + now := time.Now() + + return &Position{ + id: GeneratePositionID(), + title: titleVO, + description: descriptionVO, + departmentID: deptIDVO, + requirements: requirementsVO, + salaryRange: salaryRangeVO, + createdAt: now, + updatedAt: now, + }, nil +} + +// NewPositionWithID creates a Position entity with a specific ID (for reconstruction from persistence) +func NewPositionWithID(id, title, description, requirements string, departmentID *string, minSalary, maxSalary float64, createdAt, updatedAt time.Time) (*Position, error) { + positionID, err := NewPositionID(id) + if err != nil { + return nil, err + } + + titleVO, err := NewTitle(title) + if err != nil { + return nil, err + } + + descriptionVO, err := NewDescription(description) + if err != nil { + return nil, err + } + + requirementsVO, err := NewRequirements(requirements) + if err != nil { + return nil, err + } + + var deptIDVO *DepartmentID + if departmentID != nil { + deptID, err := NewDepartmentID(*departmentID) + if err != nil { + return nil, err + } + deptIDVO = &deptID + } + + salaryRangeVO, err := NewSalaryRange(minSalary, maxSalary) + if err != nil { + return nil, err + } + + return &Position{ + id: positionID, + title: titleVO, + description: descriptionVO, + departmentID: deptIDVO, + requirements: requirementsVO, + salaryRange: salaryRangeVO, + createdAt: createdAt, + updatedAt: updatedAt, + }, nil +} + +// ID returns the position's ID +func (p *Position) ID() PositionID { + return p.id +} + +// Title returns the position's title +func (p *Position) Title() Title { + return p.title +} + +// Description returns the position's description +func (p *Position) Description() Description { + return p.description +} + +// DepartmentID returns the position's department ID +func (p *Position) DepartmentID() *DepartmentID { + return p.departmentID +} + +// Requirements returns the position's requirements +func (p *Position) Requirements() Requirements { + return p.requirements +} + +// SalaryRange returns the position's salary range +func (p *Position) SalaryRange() SalaryRange { + return p.salaryRange +} + +// CreatedAt returns when the position was created +func (p *Position) CreatedAt() time.Time { + return p.createdAt +} + +// UpdatedAt returns when the position was last updated +func (p *Position) UpdatedAt() time.Time { + return p.updatedAt +} + +// UpdateTitle updates the position's title with validation +func (p *Position) UpdateTitle(title string) error { + titleVO, err := NewTitle(title) + if err != nil { + return err + } + + p.title = titleVO + p.updatedAt = time.Now() + return nil +} + +// UpdateDescription updates the position's description with validation +func (p *Position) UpdateDescription(description string) error { + descriptionVO, err := NewDescription(description) + if err != nil { + return err + } + + p.description = descriptionVO + p.updatedAt = time.Now() + return nil +} + +// UpdateRequirements updates the position's requirements with validation +func (p *Position) UpdateRequirements(requirements string) error { + requirementsVO, err := NewRequirements(requirements) + if err != nil { + return err + } + + p.requirements = requirementsVO + p.updatedAt = time.Now() + return nil +} + +// UpdateDepartment updates the position's department with validation +func (p *Position) UpdateDepartment(departmentID *string) error { + var deptIDVO *DepartmentID + if departmentID != nil { + deptID, err := NewDepartmentID(*departmentID) + if err != nil { + return err + } + deptIDVO = &deptID + } + + p.departmentID = deptIDVO + p.updatedAt = time.Now() + return nil +} + +// UpdateSalaryRange updates the position's salary range with validation +func (p *Position) UpdateSalaryRange(minSalary, maxSalary float64) error { + salaryRangeVO, err := NewSalaryRange(minSalary, maxSalary) + if err != nil { + return err + } + + p.salaryRange = salaryRangeVO + p.updatedAt = time.Now() + return nil +} + +// Validate performs comprehensive validation of the position entity +func (p *Position) Validate() error { + if p.id.String() == "" { + return errors.ErrInvalidPositionID + } + + if p.title.String() == "" { + return errors.ErrInvalidPositionTitle + } + + if p.description.String() == "" { + return errors.ErrInvalidPositionDescription + } + + if p.requirements.String() == "" { + return errors.ErrInvalidPositionRequirements + } + + if p.createdAt.IsZero() { + return errors.DomainError{ + Code: "INVALID_CREATED_AT", + Message: "Created at timestamp cannot be zero", + Field: "createdAt", + } + } + + if p.updatedAt.IsZero() { + return errors.DomainError{ + Code: "INVALID_UPDATED_AT", + Message: "Updated at timestamp cannot be zero", + Field: "updatedAt", + } + } + + if p.updatedAt.Before(p.createdAt) { + return errors.DomainError{ + Code: "INVALID_TIMESTAMPS", + Message: "Updated at cannot be before created at", + Field: "updatedAt", + } + } + + return nil +} + +// Equals checks if two positions are equal based on their ID +func (p *Position) Equals(other *Position) bool { + if other == nil { + return false + } + return p.id.Equals(other.id) +} \ No newline at end of file diff --git a/internal/domain/position/repository.go b/internal/domain/position/repository.go new file mode 100644 index 0000000..35e03a7 --- /dev/null +++ b/internal/domain/position/repository.go @@ -0,0 +1,34 @@ +package position + +import ( + "context" +) + +//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mocks/mock_$GOFILE -package=mocks + +// Repository defines the interface for position data access +type Repository interface { + // FindByID retrieves a position by its ID + FindByID(ctx context.Context, id PositionID) (*Position, error) + + // FindByTitle retrieves a position by its title + FindByTitle(ctx context.Context, title Title) (*Position, error) + + // FindAll retrieves positions with pagination support + FindAll(ctx context.Context, limit int, cursor string) ([]*Position, string, error) + + // FindByDepartment retrieves positions by department ID + FindByDepartment(ctx context.Context, departmentID DepartmentID, limit int, cursor string) ([]*Position, string, error) + + // Save persists a position (create or update) + Save(ctx context.Context, position *Position) error + + // Delete removes a position by ID + Delete(ctx context.Context, id PositionID) error + + // Exists checks if a position exists by ID + Exists(ctx context.Context, id PositionID) (bool, error) + + // ExistsByTitle checks if a position exists by title + ExistsByTitle(ctx context.Context, title Title, excludeID *PositionID) (bool, error) +} \ No newline at end of file diff --git a/internal/domain/position/service.go b/internal/domain/position/service.go new file mode 100644 index 0000000..b9277fb --- /dev/null +++ b/internal/domain/position/service.go @@ -0,0 +1,83 @@ +package position + +import ( + "context" + + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" +) + +//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mocks/mock_$GOFILE -package=mocks + +// DomainService defines domain-specific business logic that doesn't belong to a single entity +type DomainService interface { + // ValidateUniqueTitle ensures position title uniqueness across the domain + ValidateUniqueTitle(ctx context.Context, title Title, excludePositionID *PositionID) error + + // CanDeletePosition checks if a position can be safely deleted + CanDeletePosition(ctx context.Context, positionID PositionID) error + + // ValidateDepartmentExists checks if the assigned department exists and is valid + ValidateDepartmentExists(ctx context.Context, departmentID *DepartmentID) error +} + +// domainService implements the DomainService interface +type domainService struct { + positionRepo Repository +} + +// NewDomainService creates a new domain service instance +func NewDomainService(positionRepo Repository) DomainService { + return &domainService{ + positionRepo: positionRepo, + } +} + +// ValidateUniqueTitle ensures position title uniqueness across the domain +func (s *domainService) ValidateUniqueTitle(ctx context.Context, title Title, excludePositionID *PositionID) error { + existingPosition, err := s.positionRepo.FindByTitle(ctx, title) + if err != nil { + // If position not found, title is unique + if err == errors.ErrPositionNotFound { + return nil + } + return err + } + + // If we're excluding a specific position ID (for updates), check if it's the same position + if excludePositionID != nil && existingPosition.ID().Equals(*excludePositionID) { + return nil + } + + return errors.ErrDuplicatePositionTitle +} + +// CanDeletePosition checks if a position can be safely deleted +func (s *domainService) CanDeletePosition(ctx context.Context, positionID PositionID) error { + // Check if position exists + _, err := s.positionRepo.FindByID(ctx, positionID) + if err != nil { + return err + } + + // Add any business rules for deletion here + // For example: check if position has active employees, etc. + // For now, we allow all deletions + + return nil +} + +// ValidateDepartmentExists checks if the assigned department exists and is valid +func (s *domainService) ValidateDepartmentExists(ctx context.Context, departmentID *DepartmentID) error { + if departmentID == nil { + // No department assigned is valid + return nil + } + + // In a real implementation, you would check against the department repository + // For now, we'll just validate the format + if departmentID.String() == "" { + return errors.ErrInvalidDepartmentID + } + + return nil +} \ No newline at end of file diff --git a/internal/domain/position/value_objects.go b/internal/domain/position/value_objects.go new file mode 100644 index 0000000..d4a97c4 --- /dev/null +++ b/internal/domain/position/value_objects.go @@ -0,0 +1,334 @@ +package position + +import ( + "regexp" + "strings" + + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" + "github.com/google/uuid" +) + +// PositionID represents a position identifier +type PositionID struct { + value string +} + +// NewPositionID creates a new PositionID from a string +func NewPositionID(value string) (PositionID, error) { + if value == "" { + return PositionID{}, errors.ErrInvalidPositionID + } + + // Validate UUID format + if _, err := uuid.Parse(value); err != nil { + return PositionID{}, errors.ErrInvalidPositionID + } + + return PositionID{value: value}, nil +} + +// GeneratePositionID generates a new PositionID +func GeneratePositionID() PositionID { + return PositionID{value: uuid.New().String()} +} + +// String returns the string representation of the PositionID +func (p PositionID) String() string { + return p.value +} + +// Equals checks if two PositionIDs are equal +func (p PositionID) Equals(other PositionID) bool { + return p.value == other.value +} + +// Title represents a position title +type Title struct { + value string +} + +// NewTitle creates a new Title from a string +func NewTitle(value string) (Title, error) { + if value == "" { + return Title{}, errors.ErrInvalidPositionTitle + } + + trimmed := strings.TrimSpace(value) + if trimmed == "" { + return Title{}, errors.ErrInvalidPositionTitle + } + + if len(trimmed) > 100 { + return Title{}, errors.DomainError{ + Code: "POSITION_TITLE_TOO_LONG", + Message: "Position title cannot exceed 100 characters", + Field: "title", + } + } + + // Check for valid characters (letters, numbers, spaces, hyphens, underscores) + validTitleRegex := regexp.MustCompile(`^[a-zA-Z0-9\s\-_]+$`) + if !validTitleRegex.MatchString(trimmed) { + return Title{}, errors.DomainError{ + Code: "INVALID_POSITION_TITLE_CHARACTERS", + Message: "Position title can only contain letters, numbers, spaces, hyphens, and underscores", + Field: "title", + } + } + + return Title{value: trimmed}, nil +} + +// String returns the string representation of the Title +func (t Title) String() string { + return t.value +} + +// Equals checks if two Titles are equal +func (t Title) Equals(other Title) bool { + return t.value == other.value +} + +// Description represents a position description +type Description struct { + value string +} + +// NewDescription creates a new Description from a string +func NewDescription(value string) (Description, error) { + if value == "" { + return Description{}, errors.ErrInvalidPositionDescription + } + + trimmed := strings.TrimSpace(value) + if trimmed == "" { + return Description{}, errors.ErrInvalidPositionDescription + } + + if len(trimmed) > 1000 { + return Description{}, errors.DomainError{ + Code: "POSITION_DESCRIPTION_TOO_LONG", + Message: "Position description cannot exceed 1000 characters", + Field: "description", + } + } + + return Description{value: trimmed}, nil +} + +// String returns the string representation of the Description +func (d Description) String() string { + return d.value +} + +// Equals checks if two Descriptions are equal +func (d Description) Equals(other Description) bool { + return d.value == other.value +} + +// Requirements represents position requirements +type Requirements struct { + value string +} + +// NewRequirements creates a new Requirements from a string +func NewRequirements(value string) (Requirements, error) { + if value == "" { + return Requirements{}, errors.ErrInvalidPositionRequirements + } + + trimmed := strings.TrimSpace(value) + if trimmed == "" { + return Requirements{}, errors.ErrInvalidPositionRequirements + } + + if len(trimmed) > 2000 { + return Requirements{}, errors.DomainError{ + Code: "POSITION_REQUIREMENTS_TOO_LONG", + Message: "Position requirements cannot exceed 2000 characters", + Field: "requirements", + } + } + + return Requirements{value: trimmed}, nil +} + +// String returns the string representation of the Requirements +func (r Requirements) String() string { + return r.value +} + +// Equals checks if two Requirements are equal +func (r Requirements) Equals(other Requirements) bool { + return r.value == other.value +} + +// SalaryRange represents a salary range +type SalaryRange struct { + minSalary float64 + maxSalary float64 +} + +// NewSalaryRange creates a new SalaryRange +func NewSalaryRange(minSalary, maxSalary float64) (SalaryRange, error) { + if minSalary < 0 { + return SalaryRange{}, errors.DomainError{ + Code: "INVALID_MIN_SALARY", + Message: "Minimum salary cannot be negative", + Field: "minSalary", + } + } + + if maxSalary < 0 { + return SalaryRange{}, errors.DomainError{ + Code: "INVALID_MAX_SALARY", + Message: "Maximum salary cannot be negative", + Field: "maxSalary", + } + } + + if minSalary > maxSalary { + return SalaryRange{}, errors.DomainError{ + Code: "INVALID_SALARY_RANGE", + Message: "Minimum salary cannot be greater than maximum salary", + Field: "salaryRange", + } + } + + return SalaryRange{ + minSalary: minSalary, + maxSalary: maxSalary, + }, nil +} + +// MinSalary returns the minimum salary +func (s SalaryRange) MinSalary() float64 { + return s.minSalary +} + +// MaxSalary returns the maximum salary +func (s SalaryRange) MaxSalary() float64 { + return s.maxSalary +} + +// Equals checks if two SalaryRanges are equal +func (s SalaryRange) Equals(other SalaryRange) bool { + return s.minSalary == other.minSalary && s.maxSalary == other.maxSalary +} + +// DepartmentID represents a department identifier (reused from department domain) +type DepartmentID struct { + value string +} + +// NewDepartmentID creates a new DepartmentID from a string +func NewDepartmentID(value string) (DepartmentID, error) { + if value == "" { + return DepartmentID{}, errors.ErrInvalidDepartmentID + } + + // Validate UUID format + if _, err := uuid.Parse(value); err != nil { + return DepartmentID{}, errors.ErrInvalidDepartmentID + } + + return DepartmentID{value: value}, nil +} + +// String returns the string representation of the DepartmentID +func (d DepartmentID) String() string { + return d.value +} + +// Equals checks if two DepartmentIDs are equal +func (d DepartmentID) Equals(other DepartmentID) bool { + return d.value == other.value +} + +// ValidatePositionID validates a position ID string +func ValidatePositionID(id string) error { + if id == "" { + return errors.ErrInvalidPositionID + } + + if _, err := uuid.Parse(id); err != nil { + return errors.ErrInvalidPositionID + } + + return nil +} + +// ValidatePositionTitle validates a position title string +func ValidatePositionTitle(title string) error { + if title == "" { + return errors.ErrInvalidPositionTitle + } + + trimmed := strings.TrimSpace(title) + if trimmed == "" { + return errors.ErrInvalidPositionTitle + } + + if len(trimmed) > 100 { + return errors.DomainError{ + Code: "POSITION_TITLE_TOO_LONG", + Message: "Position title cannot exceed 100 characters", + Field: "title", + } + } + + validTitleRegex := regexp.MustCompile(`^[a-zA-Z0-9\s\-_]+$`) + if !validTitleRegex.MatchString(trimmed) { + return errors.DomainError{ + Code: "INVALID_POSITION_TITLE_CHARACTERS", + Message: "Position title can only contain letters, numbers, spaces, hyphens, and underscores", + Field: "title", + } + } + + return nil +} + +// ValidatePositionDescription validates a position description string +func ValidatePositionDescription(description string) error { + if description == "" { + return errors.ErrInvalidPositionDescription + } + + trimmed := strings.TrimSpace(description) + if trimmed == "" { + return errors.ErrInvalidPositionDescription + } + + if len(trimmed) > 1000 { + return errors.DomainError{ + Code: "POSITION_DESCRIPTION_TOO_LONG", + Message: "Position description cannot exceed 1000 characters", + Field: "description", + } + } + + return nil +} + +// ValidatePositionRequirements validates position requirements string +func ValidatePositionRequirements(requirements string) error { + if requirements == "" { + return errors.ErrInvalidPositionRequirements + } + + trimmed := strings.TrimSpace(requirements) + if trimmed == "" { + return errors.ErrInvalidPositionRequirements + } + + if len(trimmed) > 2000 { + return errors.DomainError{ + Code: "POSITION_REQUIREMENTS_TOO_LONG", + Message: "Position requirements cannot exceed 2000 characters", + Field: "requirements", + } + } + + return nil +} \ No newline at end of file diff --git a/internal/infrastructure/persistence/sql/department_repository.go b/internal/infrastructure/persistence/sql/department_repository.go new file mode 100644 index 0000000..bb2217d --- /dev/null +++ b/internal/infrastructure/persistence/sql/department_repository.go @@ -0,0 +1,406 @@ +package sql + +import ( + "context" + "database/sql" + "fmt" + "log/slog" + "time" + + "github.com/captain-corgi/go-graphql-example/internal/domain/department" + "github.com/captain-corgi/go-graphql-example/internal/domain/errors" + "github.com/captain-corgi/go-graphql-example/internal/infrastructure/database" + "github.com/lib/pq" +) + +// departmentRepository implements the department.Repository interface using SQL +type departmentRepository struct { + db *database.DB + logger *slog.Logger +} + +// NewDepartmentRepository creates a new SQL-based department repository +func NewDepartmentRepository(db *database.DB, logger *slog.Logger) department.Repository { + return &departmentRepository{ + db: db, + logger: logger, + } +} + +// FindByID retrieves a department by its ID +func (r *departmentRepository) FindByID(ctx context.Context, id department.DepartmentID) (*department.Department, error) { + r.logger.DebugContext(ctx, "Finding department by ID", "department_id", id.String()) + + query := ` + SELECT id, name, description, manager_id, created_at, updated_at + FROM departments + WHERE id = $1` + + var deptID, name, description string + var managerID sql.NullString + var createdAt, updatedAt time.Time + + err := r.db.QueryRowContext(ctx, query, id.String()).Scan( + &deptID, &name, &description, &managerID, &createdAt, &updatedAt, + ) + + if err != nil { + if err == sql.ErrNoRows { + r.logger.DebugContext(ctx, "Department not found", "department_id", id.String()) + return nil, errors.ErrDepartmentNotFound + } + r.logger.ErrorContext(ctx, "Failed to find department by ID", "error", err, "department_id", id.String()) + return nil, fmt.Errorf("failed to find department by ID: %w", err) + } + + var managerIDPtr *string + if managerID.Valid { + managerIDPtr = &managerID.String + } + + domainDept, err := department.NewDepartmentWithID(deptID, name, description, managerIDPtr, createdAt, updatedAt) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to create domain department from database record", "error", err) + return nil, fmt.Errorf("failed to create domain department: %w", err) + } + + r.logger.DebugContext(ctx, "Successfully found department by ID", "department_id", id.String()) + return domainDept, nil +} + +// FindByName retrieves a department by its name +func (r *departmentRepository) FindByName(ctx context.Context, name department.Name) (*department.Department, error) { + r.logger.DebugContext(ctx, "Finding department by name", "name", name.String()) + + query := ` + SELECT id, name, description, manager_id, created_at, updated_at + FROM departments + WHERE name = $1` + + var deptID, deptName, description string + var managerID sql.NullString + var createdAt, updatedAt time.Time + + err := r.db.QueryRowContext(ctx, query, name.String()).Scan( + &deptID, &deptName, &description, &managerID, &createdAt, &updatedAt, + ) + + if err != nil { + if err == sql.ErrNoRows { + r.logger.DebugContext(ctx, "Department not found by name", "name", name.String()) + return nil, errors.ErrDepartmentNotFound + } + r.logger.ErrorContext(ctx, "Failed to find department by name", "error", err, "name", name.String()) + return nil, fmt.Errorf("failed to find department by name: %w", err) + } + + var managerIDPtr *string + if managerID.Valid { + managerIDPtr = &managerID.String + } + + domainDept, err := department.NewDepartmentWithID(deptID, deptName, description, managerIDPtr, createdAt, updatedAt) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to create domain department from database record", "error", err) + return nil, fmt.Errorf("failed to create domain department: %w", err) + } + + r.logger.DebugContext(ctx, "Successfully found department by name", "name", name.String()) + return domainDept, nil +} + +// FindAll retrieves departments with pagination support +func (r *departmentRepository) FindAll(ctx context.Context, limit int, cursor string) ([]*department.Department, string, error) { + r.logger.DebugContext(ctx, "Finding all departments", "limit", limit, "cursor", cursor) + + var query string + var args []interface{} + + if cursor != "" { + query = ` + SELECT id, name, description, manager_id, created_at, updated_at + FROM departments + WHERE id > $1 + ORDER BY id + LIMIT $2` + args = []interface{}{cursor, limit} + } else { + query = ` + SELECT id, name, description, manager_id, created_at, updated_at + FROM departments + ORDER BY id + LIMIT $1` + args = []interface{}{limit} + } + + rows, err := r.db.QueryContext(ctx, query, args...) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to query departments", "error", err) + return nil, "", fmt.Errorf("failed to query departments: %w", err) + } + defer rows.Close() + + var departments []*department.Department + var lastID string + + for rows.Next() { + var deptID, name, description string + var managerID sql.NullString + var createdAt, updatedAt time.Time + + err := rows.Scan(&deptID, &name, &description, &managerID, &createdAt, &updatedAt) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to scan department row", "error", err) + return nil, "", fmt.Errorf("failed to scan department row: %w", err) + } + + var managerIDPtr *string + if managerID.Valid { + managerIDPtr = &managerID.String + } + + domainDept, err := department.NewDepartmentWithID(deptID, name, description, managerIDPtr, createdAt, updatedAt) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to create domain department from database record", "error", err) + return nil, "", fmt.Errorf("failed to create domain department: %w", err) + } + + departments = append(departments, domainDept) + lastID = deptID + } + + if err = rows.Err(); err != nil { + r.logger.ErrorContext(ctx, "Error iterating department rows", "error", err) + return nil, "", fmt.Errorf("error iterating department rows: %w", err) + } + + var nextCursor string + if len(departments) == limit { + nextCursor = lastID + } + + r.logger.DebugContext(ctx, "Successfully found departments", "count", len(departments), "nextCursor", nextCursor) + return departments, nextCursor, nil +} + +// FindByManager retrieves departments by manager ID +func (r *departmentRepository) FindByManager(ctx context.Context, managerID department.EmployeeID, limit int, cursor string) ([]*department.Department, string, error) { + r.logger.DebugContext(ctx, "Finding departments by manager", "manager_id", managerID.String(), "limit", limit, "cursor", cursor) + + var query string + var args []interface{} + + if cursor != "" { + query = ` + SELECT id, name, description, manager_id, created_at, updated_at + FROM departments + WHERE manager_id = $1 AND id > $2 + ORDER BY id + LIMIT $3` + args = []interface{}{managerID.String(), cursor, limit} + } else { + query = ` + SELECT id, name, description, manager_id, created_at, updated_at + FROM departments + WHERE manager_id = $1 + ORDER BY id + LIMIT $2` + args = []interface{}{managerID.String(), limit} + } + + rows, err := r.db.QueryContext(ctx, query, args...) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to query departments by manager", "error", err) + return nil, "", fmt.Errorf("failed to query departments by manager: %w", err) + } + defer rows.Close() + + var departments []*department.Department + var lastID string + + for rows.Next() { + var deptID, name, description string + var managerID sql.NullString + var createdAt, updatedAt time.Time + + err := rows.Scan(&deptID, &name, &description, &managerID, &createdAt, &updatedAt) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to scan department row", "error", err) + return nil, "", fmt.Errorf("failed to scan department row: %w", err) + } + + var managerIDPtr *string + if managerID.Valid { + managerIDPtr = &managerID.String + } + + domainDept, err := department.NewDepartmentWithID(deptID, name, description, managerIDPtr, createdAt, updatedAt) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to create domain department from database record", "error", err) + return nil, "", fmt.Errorf("failed to create domain department: %w", err) + } + + departments = append(departments, domainDept) + lastID = deptID + } + + if err = rows.Err(); err != nil { + r.logger.ErrorContext(ctx, "Error iterating department rows", "error", err) + return nil, "", fmt.Errorf("error iterating department rows: %w", err) + } + + var nextCursor string + if len(departments) == limit { + nextCursor = lastID + } + + r.logger.DebugContext(ctx, "Successfully found departments by manager", "count", len(departments), "nextCursor", nextCursor) + return departments, nextCursor, nil +} + +// Save persists a department (create or update) +func (r *departmentRepository) Save(ctx context.Context, dept *department.Department) error { + r.logger.DebugContext(ctx, "Saving department", "department_id", dept.ID().String()) + + // Check if department exists + exists, err := r.Exists(ctx, dept.ID()) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to check if department exists", "error", err) + return fmt.Errorf("failed to check if department exists: %w", err) + } + + var managerID sql.NullString + if dept.ManagerID() != nil { + managerID.String = dept.ManagerID().String() + managerID.Valid = true + } + + if exists { + // Update existing department + query := ` + UPDATE departments + SET name = $1, description = $2, manager_id = $3, updated_at = $4 + WHERE id = $5` + + result, err := r.db.ExecContext(ctx, query, + dept.Name().String(), + dept.Description().String(), + managerID, + dept.UpdatedAt(), + dept.ID().String(), + ) + + if err != nil { + r.logger.ErrorContext(ctx, "Failed to update department", "error", err) + return fmt.Errorf("failed to update department: %w", err) + } + + rowsAffected, err := result.RowsAffected() + if err != nil { + r.logger.ErrorContext(ctx, "Failed to get rows affected", "error", err) + return fmt.Errorf("failed to get rows affected: %w", err) + } + + if rowsAffected == 0 { + r.logger.WarnContext(ctx, "No rows affected when updating department", "department_id", dept.ID().String()) + return errors.ErrDepartmentNotFound + } + } else { + // Insert new department + query := ` + INSERT INTO departments (id, name, description, manager_id, created_at, updated_at) + VALUES ($1, $2, $3, $4, $5, $6)` + + _, err := r.db.ExecContext(ctx, query, + dept.ID().String(), + dept.Name().String(), + dept.Description().String(), + managerID, + dept.CreatedAt(), + dept.UpdatedAt(), + ) + + if err != nil { + // Check for unique constraint violation + if pqErr, ok := err.(*pq.Error); ok && pqErr.Code == "23505" { + r.logger.WarnContext(ctx, "Department name already exists", "error", err) + return errors.ErrDuplicateDepartmentName + } + r.logger.ErrorContext(ctx, "Failed to insert department", "error", err) + return fmt.Errorf("failed to insert department: %w", err) + } + } + + r.logger.DebugContext(ctx, "Successfully saved department", "department_id", dept.ID().String()) + return nil +} + +// Delete removes a department by ID +func (r *departmentRepository) Delete(ctx context.Context, id department.DepartmentID) error { + r.logger.DebugContext(ctx, "Deleting department", "department_id", id.String()) + + query := `DELETE FROM departments WHERE id = $1` + + result, err := r.db.ExecContext(ctx, query, id.String()) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to delete department", "error", err) + return fmt.Errorf("failed to delete department: %w", err) + } + + rowsAffected, err := result.RowsAffected() + if err != nil { + r.logger.ErrorContext(ctx, "Failed to get rows affected", "error", err) + return fmt.Errorf("failed to get rows affected: %w", err) + } + + if rowsAffected == 0 { + r.logger.WarnContext(ctx, "No rows affected when deleting department", "department_id", id.String()) + return errors.ErrDepartmentNotFound + } + + r.logger.DebugContext(ctx, "Successfully deleted department", "department_id", id.String()) + return nil +} + +// Exists checks if a department exists by ID +func (r *departmentRepository) Exists(ctx context.Context, id department.DepartmentID) (bool, error) { + r.logger.DebugContext(ctx, "Checking if department exists", "department_id", id.String()) + + query := `SELECT EXISTS(SELECT 1 FROM departments WHERE id = $1)` + + var exists bool + err := r.db.QueryRowContext(ctx, query, id.String()).Scan(&exists) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to check if department exists", "error", err) + return false, fmt.Errorf("failed to check if department exists: %w", err) + } + + r.logger.DebugContext(ctx, "Department exists check result", "department_id", id.String(), "exists", exists) + return exists, nil +} + +// ExistsByName checks if a department exists by name +func (r *departmentRepository) ExistsByName(ctx context.Context, name department.Name, excludeID *department.DepartmentID) (bool, error) { + r.logger.DebugContext(ctx, "Checking if department exists by name", "name", name.String(), "exclude_id", excludeID) + + var query string + var args []interface{} + + if excludeID != nil { + query = `SELECT EXISTS(SELECT 1 FROM departments WHERE name = $1 AND id != $2)` + args = []interface{}{name.String(), excludeID.String()} + } else { + query = `SELECT EXISTS(SELECT 1 FROM departments WHERE name = $1)` + args = []interface{}{name.String()} + } + + var exists bool + err := r.db.QueryRowContext(ctx, query, args...).Scan(&exists) + if err != nil { + r.logger.ErrorContext(ctx, "Failed to check if department exists by name", "error", err) + return false, fmt.Errorf("failed to check if department exists by name: %w", err) + } + + r.logger.DebugContext(ctx, "Department exists by name check result", "name", name.String(), "exists", exists) + return exists, nil +} \ No newline at end of file diff --git a/internal/interfaces/graphql/generated/generated.go b/internal/interfaces/graphql/generated/generated.go index ce4340f..b4930d9 100644 --- a/internal/interfaces/graphql/generated/generated.go +++ b/internal/interfaces/graphql/generated/generated.go @@ -46,26 +46,85 @@ type DirectiveRoot struct { } type ComplexityRoot struct { + ApproveLeavePayload struct { + Errors func(childComplexity int) int + Leave func(childComplexity int) int + } + + CancelLeavePayload struct { + Errors func(childComplexity int) int + Leave func(childComplexity int) int + } + + CreateDepartmentPayload struct { + Department func(childComplexity int) int + Errors func(childComplexity int) int + } + CreateEmployeePayload struct { Employee func(childComplexity int) int Errors func(childComplexity int) int } + CreateLeavePayload struct { + Errors func(childComplexity int) int + Leave func(childComplexity int) int + } + + CreatePositionPayload struct { + Errors func(childComplexity int) int + Position func(childComplexity int) int + } + CreateUserPayload struct { Errors func(childComplexity int) int User func(childComplexity int) int } + DeleteDepartmentPayload struct { + Errors func(childComplexity int) int + Success func(childComplexity int) int + } + DeleteEmployeePayload struct { Errors func(childComplexity int) int Success func(childComplexity int) int } + DeleteLeavePayload struct { + Errors func(childComplexity int) int + Success func(childComplexity int) int + } + + DeletePositionPayload struct { + Errors func(childComplexity int) int + Success func(childComplexity int) int + } + DeleteUserPayload struct { Errors func(childComplexity int) int Success func(childComplexity int) int } + Department struct { + CreatedAt func(childComplexity int) int + Description func(childComplexity int) int + ID func(childComplexity int) int + ManagerID func(childComplexity int) int + Name func(childComplexity int) int + UpdatedAt func(childComplexity int) int + } + + DepartmentConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + DepartmentEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + Employee struct { CreatedAt func(childComplexity int) int Department func(childComplexity int) int @@ -95,13 +154,49 @@ type ComplexityRoot struct { Message func(childComplexity int) int } + Leave struct { + ApprovedAt func(childComplexity int) int + ApprovedBy func(childComplexity int) int + CreatedAt func(childComplexity int) int + EmployeeID func(childComplexity int) int + EndDate func(childComplexity int) int + ID func(childComplexity int) int + LeaveType func(childComplexity int) int + Reason func(childComplexity int) int + StartDate func(childComplexity int) int + Status func(childComplexity int) int + UpdatedAt func(childComplexity int) int + } + + LeaveConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + LeaveEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + Mutation struct { - CreateEmployee func(childComplexity int, input model.CreateEmployeeInput) int - CreateUser func(childComplexity int, input model.CreateUserInput) int - DeleteEmployee func(childComplexity int, id string) int - DeleteUser func(childComplexity int, id string) int - UpdateEmployee func(childComplexity int, id string, input model.UpdateEmployeeInput) int - UpdateUser func(childComplexity int, id string, input model.UpdateUserInput) int + ApproveLeave func(childComplexity int, id string, input model.ApproveLeaveInput) int + CancelLeave func(childComplexity int, id string) int + CreateDepartment func(childComplexity int, input model.CreateDepartmentInput) int + CreateEmployee func(childComplexity int, input model.CreateEmployeeInput) int + CreateLeave func(childComplexity int, input model.CreateLeaveInput) int + CreatePosition func(childComplexity int, input model.CreatePositionInput) int + CreateUser func(childComplexity int, input model.CreateUserInput) int + DeleteDepartment func(childComplexity int, id string) int + DeleteEmployee func(childComplexity int, id string) int + DeleteLeave func(childComplexity int, id string) int + DeletePosition func(childComplexity int, id string) int + DeleteUser func(childComplexity int, id string) int + RejectLeave func(childComplexity int, id string, input model.ApproveLeaveInput) int + UpdateDepartment func(childComplexity int, id string, input model.UpdateDepartmentInput) int + UpdateEmployee func(childComplexity int, id string, input model.UpdateEmployeeInput) int + UpdateLeave func(childComplexity int, id string, input model.UpdateLeaveInput) int + UpdatePosition func(childComplexity int, id string, input model.UpdatePositionInput) int + UpdateUser func(childComplexity int, id string, input model.UpdateUserInput) int } PageInfo struct { @@ -111,20 +206,72 @@ type ComplexityRoot struct { StartCursor func(childComplexity int) int } + Position struct { + CreatedAt func(childComplexity int) int + DepartmentID func(childComplexity int) int + Description func(childComplexity int) int + ID func(childComplexity int) int + MaxSalary func(childComplexity int) int + MinSalary func(childComplexity int) int + Requirements func(childComplexity int) int + Title func(childComplexity int) int + UpdatedAt func(childComplexity int) int + } + + PositionConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + PositionEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + Query struct { + Department func(childComplexity int, id string) int + Departments func(childComplexity int, first *int, after *string) int + DepartmentsByManager func(childComplexity int, managerID string, first *int, after *string) int Employee func(childComplexity int, id string) int Employees func(childComplexity int, first *int, after *string) int EmployeesByDepartment func(childComplexity int, department string, first *int, after *string) int EmployeesByStatus func(childComplexity int, status string, first *int, after *string) int + Leave func(childComplexity int, id string) int + Leaves func(childComplexity int, first *int, after *string) int + LeavesByEmployee func(childComplexity int, employeeID string, first *int, after *string) int + LeavesByStatus func(childComplexity int, status string, first *int, after *string) int + Position func(childComplexity int, id string) int + Positions func(childComplexity int, first *int, after *string) int + PositionsByDepartment func(childComplexity int, departmentID string, first *int, after *string) int User func(childComplexity int, id string) int Users func(childComplexity int, first *int, after *string) int } + RejectLeavePayload struct { + Errors func(childComplexity int) int + Leave func(childComplexity int) int + } + + UpdateDepartmentPayload struct { + Department func(childComplexity int) int + Errors func(childComplexity int) int + } + UpdateEmployeePayload struct { Employee func(childComplexity int) int Errors func(childComplexity int) int } + UpdateLeavePayload struct { + Errors func(childComplexity int) int + Leave func(childComplexity int) int + } + + UpdatePositionPayload struct { + Errors func(childComplexity int) int + Position func(childComplexity int) int + } + UpdateUserPayload struct { Errors func(childComplexity int) int User func(childComplexity int) int @@ -156,6 +303,18 @@ type MutationResolver interface { CreateEmployee(ctx context.Context, input model.CreateEmployeeInput) (*model.CreateEmployeePayload, error) UpdateEmployee(ctx context.Context, id string, input model.UpdateEmployeeInput) (*model.UpdateEmployeePayload, error) DeleteEmployee(ctx context.Context, id string) (*model.DeleteEmployeePayload, error) + CreateDepartment(ctx context.Context, input model.CreateDepartmentInput) (*model.CreateDepartmentPayload, error) + UpdateDepartment(ctx context.Context, id string, input model.UpdateDepartmentInput) (*model.UpdateDepartmentPayload, error) + DeleteDepartment(ctx context.Context, id string) (*model.DeleteDepartmentPayload, error) + CreatePosition(ctx context.Context, input model.CreatePositionInput) (*model.CreatePositionPayload, error) + UpdatePosition(ctx context.Context, id string, input model.UpdatePositionInput) (*model.UpdatePositionPayload, error) + DeletePosition(ctx context.Context, id string) (*model.DeletePositionPayload, error) + CreateLeave(ctx context.Context, input model.CreateLeaveInput) (*model.CreateLeavePayload, error) + UpdateLeave(ctx context.Context, id string, input model.UpdateLeaveInput) (*model.UpdateLeavePayload, error) + ApproveLeave(ctx context.Context, id string, input model.ApproveLeaveInput) (*model.ApproveLeavePayload, error) + RejectLeave(ctx context.Context, id string, input model.ApproveLeaveInput) (*model.RejectLeavePayload, error) + CancelLeave(ctx context.Context, id string) (*model.CancelLeavePayload, error) + DeleteLeave(ctx context.Context, id string) (*model.DeleteLeavePayload, error) } type QueryResolver interface { User(ctx context.Context, id string) (*model.User, error) @@ -164,6 +323,16 @@ type QueryResolver interface { Employees(ctx context.Context, first *int, after *string) (*model.EmployeeConnection, error) EmployeesByDepartment(ctx context.Context, department string, first *int, after *string) (*model.EmployeeConnection, error) EmployeesByStatus(ctx context.Context, status string, first *int, after *string) (*model.EmployeeConnection, error) + Department(ctx context.Context, id string) (*model.Department, error) + Departments(ctx context.Context, first *int, after *string) (*model.DepartmentConnection, error) + DepartmentsByManager(ctx context.Context, managerID string, first *int, after *string) (*model.DepartmentConnection, error) + Position(ctx context.Context, id string) (*model.Position, error) + Positions(ctx context.Context, first *int, after *string) (*model.PositionConnection, error) + PositionsByDepartment(ctx context.Context, departmentID string, first *int, after *string) (*model.PositionConnection, error) + Leave(ctx context.Context, id string) (*model.Leave, error) + Leaves(ctx context.Context, first *int, after *string) (*model.LeaveConnection, error) + LeavesByEmployee(ctx context.Context, employeeID string, first *int, after *string) (*model.LeaveConnection, error) + LeavesByStatus(ctx context.Context, status string, first *int, after *string) (*model.LeaveConnection, error) } type executableSchema struct { @@ -185,6 +354,48 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin _ = ec switch typeName + "." + field { + case "ApproveLeavePayload.errors": + if e.complexity.ApproveLeavePayload.Errors == nil { + break + } + + return e.complexity.ApproveLeavePayload.Errors(childComplexity), true + + case "ApproveLeavePayload.leave": + if e.complexity.ApproveLeavePayload.Leave == nil { + break + } + + return e.complexity.ApproveLeavePayload.Leave(childComplexity), true + + case "CancelLeavePayload.errors": + if e.complexity.CancelLeavePayload.Errors == nil { + break + } + + return e.complexity.CancelLeavePayload.Errors(childComplexity), true + + case "CancelLeavePayload.leave": + if e.complexity.CancelLeavePayload.Leave == nil { + break + } + + return e.complexity.CancelLeavePayload.Leave(childComplexity), true + + case "CreateDepartmentPayload.department": + if e.complexity.CreateDepartmentPayload.Department == nil { + break + } + + return e.complexity.CreateDepartmentPayload.Department(childComplexity), true + + case "CreateDepartmentPayload.errors": + if e.complexity.CreateDepartmentPayload.Errors == nil { + break + } + + return e.complexity.CreateDepartmentPayload.Errors(childComplexity), true + case "CreateEmployeePayload.employee": if e.complexity.CreateEmployeePayload.Employee == nil { break @@ -199,6 +410,34 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.CreateEmployeePayload.Errors(childComplexity), true + case "CreateLeavePayload.errors": + if e.complexity.CreateLeavePayload.Errors == nil { + break + } + + return e.complexity.CreateLeavePayload.Errors(childComplexity), true + + case "CreateLeavePayload.leave": + if e.complexity.CreateLeavePayload.Leave == nil { + break + } + + return e.complexity.CreateLeavePayload.Leave(childComplexity), true + + case "CreatePositionPayload.errors": + if e.complexity.CreatePositionPayload.Errors == nil { + break + } + + return e.complexity.CreatePositionPayload.Errors(childComplexity), true + + case "CreatePositionPayload.position": + if e.complexity.CreatePositionPayload.Position == nil { + break + } + + return e.complexity.CreatePositionPayload.Position(childComplexity), true + case "CreateUserPayload.errors": if e.complexity.CreateUserPayload.Errors == nil { break @@ -213,6 +452,20 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.CreateUserPayload.User(childComplexity), true + case "DeleteDepartmentPayload.errors": + if e.complexity.DeleteDepartmentPayload.Errors == nil { + break + } + + return e.complexity.DeleteDepartmentPayload.Errors(childComplexity), true + + case "DeleteDepartmentPayload.success": + if e.complexity.DeleteDepartmentPayload.Success == nil { + break + } + + return e.complexity.DeleteDepartmentPayload.Success(childComplexity), true + case "DeleteEmployeePayload.errors": if e.complexity.DeleteEmployeePayload.Errors == nil { break @@ -227,6 +480,34 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.DeleteEmployeePayload.Success(childComplexity), true + case "DeleteLeavePayload.errors": + if e.complexity.DeleteLeavePayload.Errors == nil { + break + } + + return e.complexity.DeleteLeavePayload.Errors(childComplexity), true + + case "DeleteLeavePayload.success": + if e.complexity.DeleteLeavePayload.Success == nil { + break + } + + return e.complexity.DeleteLeavePayload.Success(childComplexity), true + + case "DeletePositionPayload.errors": + if e.complexity.DeletePositionPayload.Errors == nil { + break + } + + return e.complexity.DeletePositionPayload.Errors(childComplexity), true + + case "DeletePositionPayload.success": + if e.complexity.DeletePositionPayload.Success == nil { + break + } + + return e.complexity.DeletePositionPayload.Success(childComplexity), true + case "DeleteUserPayload.errors": if e.complexity.DeleteUserPayload.Errors == nil { break @@ -241,6 +522,76 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.DeleteUserPayload.Success(childComplexity), true + case "Department.createdAt": + if e.complexity.Department.CreatedAt == nil { + break + } + + return e.complexity.Department.CreatedAt(childComplexity), true + + case "Department.description": + if e.complexity.Department.Description == nil { + break + } + + return e.complexity.Department.Description(childComplexity), true + + case "Department.id": + if e.complexity.Department.ID == nil { + break + } + + return e.complexity.Department.ID(childComplexity), true + + case "Department.managerId": + if e.complexity.Department.ManagerID == nil { + break + } + + return e.complexity.Department.ManagerID(childComplexity), true + + case "Department.name": + if e.complexity.Department.Name == nil { + break + } + + return e.complexity.Department.Name(childComplexity), true + + case "Department.updatedAt": + if e.complexity.Department.UpdatedAt == nil { + break + } + + return e.complexity.Department.UpdatedAt(childComplexity), true + + case "DepartmentConnection.edges": + if e.complexity.DepartmentConnection.Edges == nil { + break + } + + return e.complexity.DepartmentConnection.Edges(childComplexity), true + + case "DepartmentConnection.pageInfo": + if e.complexity.DepartmentConnection.PageInfo == nil { + break + } + + return e.complexity.DepartmentConnection.PageInfo(childComplexity), true + + case "DepartmentEdge.cursor": + if e.complexity.DepartmentEdge.Cursor == nil { + break + } + + return e.complexity.DepartmentEdge.Cursor(childComplexity), true + + case "DepartmentEdge.node": + if e.complexity.DepartmentEdge.Node == nil { + break + } + + return e.complexity.DepartmentEdge.Node(childComplexity), true + case "Employee.createdAt": if e.complexity.Employee.CreatedAt == nil { break @@ -360,765 +711,7339 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Error.Message(childComplexity), true - case "Mutation.createEmployee": - if e.complexity.Mutation.CreateEmployee == nil { + case "Leave.approvedAt": + if e.complexity.Leave.ApprovedAt == nil { break } - args, err := ec.field_Mutation_createEmployee_args(ctx, rawArgs) - if err != nil { - return 0, false - } + return e.complexity.Leave.ApprovedAt(childComplexity), true - return e.complexity.Mutation.CreateEmployee(childComplexity, args["input"].(model.CreateEmployeeInput)), true - - case "Mutation.createUser": - if e.complexity.Mutation.CreateUser == nil { + case "Leave.approvedBy": + if e.complexity.Leave.ApprovedBy == nil { break } - args, err := ec.field_Mutation_createUser_args(ctx, rawArgs) - if err != nil { - return 0, false + return e.complexity.Leave.ApprovedBy(childComplexity), true + + case "Leave.createdAt": + if e.complexity.Leave.CreatedAt == nil { + break } - return e.complexity.Mutation.CreateUser(childComplexity, args["input"].(model.CreateUserInput)), true + return e.complexity.Leave.CreatedAt(childComplexity), true - case "Mutation.deleteEmployee": - if e.complexity.Mutation.DeleteEmployee == nil { + case "Leave.employeeId": + if e.complexity.Leave.EmployeeID == nil { break } - args, err := ec.field_Mutation_deleteEmployee_args(ctx, rawArgs) - if err != nil { - return 0, false + return e.complexity.Leave.EmployeeID(childComplexity), true + + case "Leave.endDate": + if e.complexity.Leave.EndDate == nil { + break } - return e.complexity.Mutation.DeleteEmployee(childComplexity, args["id"].(string)), true + return e.complexity.Leave.EndDate(childComplexity), true - case "Mutation.deleteUser": - if e.complexity.Mutation.DeleteUser == nil { + case "Leave.id": + if e.complexity.Leave.ID == nil { break } - args, err := ec.field_Mutation_deleteUser_args(ctx, rawArgs) - if err != nil { - return 0, false + return e.complexity.Leave.ID(childComplexity), true + + case "Leave.leaveType": + if e.complexity.Leave.LeaveType == nil { + break } - return e.complexity.Mutation.DeleteUser(childComplexity, args["id"].(string)), true + return e.complexity.Leave.LeaveType(childComplexity), true - case "Mutation.updateEmployee": - if e.complexity.Mutation.UpdateEmployee == nil { + case "Leave.reason": + if e.complexity.Leave.Reason == nil { break } - args, err := ec.field_Mutation_updateEmployee_args(ctx, rawArgs) - if err != nil { - return 0, false + return e.complexity.Leave.Reason(childComplexity), true + + case "Leave.startDate": + if e.complexity.Leave.StartDate == nil { + break } - return e.complexity.Mutation.UpdateEmployee(childComplexity, args["id"].(string), args["input"].(model.UpdateEmployeeInput)), true + return e.complexity.Leave.StartDate(childComplexity), true - case "Mutation.updateUser": - if e.complexity.Mutation.UpdateUser == nil { + case "Leave.status": + if e.complexity.Leave.Status == nil { break } - args, err := ec.field_Mutation_updateUser_args(ctx, rawArgs) - if err != nil { - return 0, false + return e.complexity.Leave.Status(childComplexity), true + + case "Leave.updatedAt": + if e.complexity.Leave.UpdatedAt == nil { + break } - return e.complexity.Mutation.UpdateUser(childComplexity, args["id"].(string), args["input"].(model.UpdateUserInput)), true + return e.complexity.Leave.UpdatedAt(childComplexity), true - case "PageInfo.endCursor": - if e.complexity.PageInfo.EndCursor == nil { + case "LeaveConnection.edges": + if e.complexity.LeaveConnection.Edges == nil { break } - return e.complexity.PageInfo.EndCursor(childComplexity), true + return e.complexity.LeaveConnection.Edges(childComplexity), true - case "PageInfo.hasNextPage": - if e.complexity.PageInfo.HasNextPage == nil { + case "LeaveConnection.pageInfo": + if e.complexity.LeaveConnection.PageInfo == nil { break } - return e.complexity.PageInfo.HasNextPage(childComplexity), true + return e.complexity.LeaveConnection.PageInfo(childComplexity), true - case "PageInfo.hasPreviousPage": - if e.complexity.PageInfo.HasPreviousPage == nil { + case "LeaveEdge.cursor": + if e.complexity.LeaveEdge.Cursor == nil { break } - return e.complexity.PageInfo.HasPreviousPage(childComplexity), true + return e.complexity.LeaveEdge.Cursor(childComplexity), true - case "PageInfo.startCursor": - if e.complexity.PageInfo.StartCursor == nil { + case "LeaveEdge.node": + if e.complexity.LeaveEdge.Node == nil { break } - return e.complexity.PageInfo.StartCursor(childComplexity), true + return e.complexity.LeaveEdge.Node(childComplexity), true - case "Query.employee": - if e.complexity.Query.Employee == nil { + case "Mutation.approveLeave": + if e.complexity.Mutation.ApproveLeave == nil { break } - args, err := ec.field_Query_employee_args(ctx, rawArgs) + args, err := ec.field_Mutation_approveLeave_args(ctx, rawArgs) if err != nil { return 0, false } - return e.complexity.Query.Employee(childComplexity, args["id"].(string)), true + return e.complexity.Mutation.ApproveLeave(childComplexity, args["id"].(string), args["input"].(model.ApproveLeaveInput)), true - case "Query.employees": - if e.complexity.Query.Employees == nil { + case "Mutation.cancelLeave": + if e.complexity.Mutation.CancelLeave == nil { break } - args, err := ec.field_Query_employees_args(ctx, rawArgs) + args, err := ec.field_Mutation_cancelLeave_args(ctx, rawArgs) if err != nil { return 0, false } - return e.complexity.Query.Employees(childComplexity, args["first"].(*int), args["after"].(*string)), true + return e.complexity.Mutation.CancelLeave(childComplexity, args["id"].(string)), true - case "Query.employeesByDepartment": - if e.complexity.Query.EmployeesByDepartment == nil { + case "Mutation.createDepartment": + if e.complexity.Mutation.CreateDepartment == nil { break } - args, err := ec.field_Query_employeesByDepartment_args(ctx, rawArgs) + args, err := ec.field_Mutation_createDepartment_args(ctx, rawArgs) if err != nil { return 0, false } - return e.complexity.Query.EmployeesByDepartment(childComplexity, args["department"].(string), args["first"].(*int), args["after"].(*string)), true + return e.complexity.Mutation.CreateDepartment(childComplexity, args["input"].(model.CreateDepartmentInput)), true - case "Query.employeesByStatus": - if e.complexity.Query.EmployeesByStatus == nil { + case "Mutation.createEmployee": + if e.complexity.Mutation.CreateEmployee == nil { break } - args, err := ec.field_Query_employeesByStatus_args(ctx, rawArgs) + args, err := ec.field_Mutation_createEmployee_args(ctx, rawArgs) if err != nil { return 0, false } - return e.complexity.Query.EmployeesByStatus(childComplexity, args["status"].(string), args["first"].(*int), args["after"].(*string)), true + return e.complexity.Mutation.CreateEmployee(childComplexity, args["input"].(model.CreateEmployeeInput)), true - case "Query.user": - if e.complexity.Query.User == nil { + case "Mutation.createLeave": + if e.complexity.Mutation.CreateLeave == nil { break } - args, err := ec.field_Query_user_args(ctx, rawArgs) + args, err := ec.field_Mutation_createLeave_args(ctx, rawArgs) if err != nil { return 0, false } - return e.complexity.Query.User(childComplexity, args["id"].(string)), true + return e.complexity.Mutation.CreateLeave(childComplexity, args["input"].(model.CreateLeaveInput)), true - case "Query.users": - if e.complexity.Query.Users == nil { + case "Mutation.createPosition": + if e.complexity.Mutation.CreatePosition == nil { break } - args, err := ec.field_Query_users_args(ctx, rawArgs) + args, err := ec.field_Mutation_createPosition_args(ctx, rawArgs) if err != nil { return 0, false } - return e.complexity.Query.Users(childComplexity, args["first"].(*int), args["after"].(*string)), true + return e.complexity.Mutation.CreatePosition(childComplexity, args["input"].(model.CreatePositionInput)), true - case "UpdateEmployeePayload.employee": - if e.complexity.UpdateEmployeePayload.Employee == nil { + case "Mutation.createUser": + if e.complexity.Mutation.CreateUser == nil { break } - return e.complexity.UpdateEmployeePayload.Employee(childComplexity), true + args, err := ec.field_Mutation_createUser_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "UpdateEmployeePayload.errors": - if e.complexity.UpdateEmployeePayload.Errors == nil { + return e.complexity.Mutation.CreateUser(childComplexity, args["input"].(model.CreateUserInput)), true + + case "Mutation.deleteDepartment": + if e.complexity.Mutation.DeleteDepartment == nil { break } - return e.complexity.UpdateEmployeePayload.Errors(childComplexity), true + args, err := ec.field_Mutation_deleteDepartment_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "UpdateUserPayload.errors": - if e.complexity.UpdateUserPayload.Errors == nil { + return e.complexity.Mutation.DeleteDepartment(childComplexity, args["id"].(string)), true + + case "Mutation.deleteEmployee": + if e.complexity.Mutation.DeleteEmployee == nil { break } - return e.complexity.UpdateUserPayload.Errors(childComplexity), true + args, err := ec.field_Mutation_deleteEmployee_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "UpdateUserPayload.user": - if e.complexity.UpdateUserPayload.User == nil { + return e.complexity.Mutation.DeleteEmployee(childComplexity, args["id"].(string)), true + + case "Mutation.deleteLeave": + if e.complexity.Mutation.DeleteLeave == nil { break } - return e.complexity.UpdateUserPayload.User(childComplexity), true + args, err := ec.field_Mutation_deleteLeave_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "User.createdAt": - if e.complexity.User.CreatedAt == nil { + return e.complexity.Mutation.DeleteLeave(childComplexity, args["id"].(string)), true + + case "Mutation.deletePosition": + if e.complexity.Mutation.DeletePosition == nil { break } - return e.complexity.User.CreatedAt(childComplexity), true + args, err := ec.field_Mutation_deletePosition_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "User.email": - if e.complexity.User.Email == nil { + return e.complexity.Mutation.DeletePosition(childComplexity, args["id"].(string)), true + + case "Mutation.deleteUser": + if e.complexity.Mutation.DeleteUser == nil { break } - return e.complexity.User.Email(childComplexity), true + args, err := ec.field_Mutation_deleteUser_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "User.id": - if e.complexity.User.ID == nil { + return e.complexity.Mutation.DeleteUser(childComplexity, args["id"].(string)), true + + case "Mutation.rejectLeave": + if e.complexity.Mutation.RejectLeave == nil { break } - return e.complexity.User.ID(childComplexity), true + args, err := ec.field_Mutation_rejectLeave_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "User.name": - if e.complexity.User.Name == nil { + return e.complexity.Mutation.RejectLeave(childComplexity, args["id"].(string), args["input"].(model.ApproveLeaveInput)), true + + case "Mutation.updateDepartment": + if e.complexity.Mutation.UpdateDepartment == nil { break } - return e.complexity.User.Name(childComplexity), true + args, err := ec.field_Mutation_updateDepartment_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "User.updatedAt": - if e.complexity.User.UpdatedAt == nil { + return e.complexity.Mutation.UpdateDepartment(childComplexity, args["id"].(string), args["input"].(model.UpdateDepartmentInput)), true + + case "Mutation.updateEmployee": + if e.complexity.Mutation.UpdateEmployee == nil { break } - return e.complexity.User.UpdatedAt(childComplexity), true + args, err := ec.field_Mutation_updateEmployee_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "UserConnection.edges": - if e.complexity.UserConnection.Edges == nil { + return e.complexity.Mutation.UpdateEmployee(childComplexity, args["id"].(string), args["input"].(model.UpdateEmployeeInput)), true + + case "Mutation.updateLeave": + if e.complexity.Mutation.UpdateLeave == nil { break } - return e.complexity.UserConnection.Edges(childComplexity), true + args, err := ec.field_Mutation_updateLeave_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "UserConnection.pageInfo": - if e.complexity.UserConnection.PageInfo == nil { + return e.complexity.Mutation.UpdateLeave(childComplexity, args["id"].(string), args["input"].(model.UpdateLeaveInput)), true + + case "Mutation.updatePosition": + if e.complexity.Mutation.UpdatePosition == nil { break } - return e.complexity.UserConnection.PageInfo(childComplexity), true + args, err := ec.field_Mutation_updatePosition_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "UserEdge.cursor": - if e.complexity.UserEdge.Cursor == nil { + return e.complexity.Mutation.UpdatePosition(childComplexity, args["id"].(string), args["input"].(model.UpdatePositionInput)), true + + case "Mutation.updateUser": + if e.complexity.Mutation.UpdateUser == nil { break } - return e.complexity.UserEdge.Cursor(childComplexity), true + args, err := ec.field_Mutation_updateUser_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "UserEdge.node": - if e.complexity.UserEdge.Node == nil { + return e.complexity.Mutation.UpdateUser(childComplexity, args["id"].(string), args["input"].(model.UpdateUserInput)), true + + case "PageInfo.endCursor": + if e.complexity.PageInfo.EndCursor == nil { break } - return e.complexity.UserEdge.Node(childComplexity), true + return e.complexity.PageInfo.EndCursor(childComplexity), true - } - return 0, false -} + case "PageInfo.hasNextPage": + if e.complexity.PageInfo.HasNextPage == nil { + break + } -func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - opCtx := graphql.GetOperationContext(ctx) - ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} - inputUnmarshalMap := graphql.BuildUnmarshalerMap( - ec.unmarshalInputCreateEmployeeInput, - ec.unmarshalInputCreateUserInput, - ec.unmarshalInputUpdateEmployeeInput, - ec.unmarshalInputUpdateUserInput, - ) - first := true + return e.complexity.PageInfo.HasNextPage(childComplexity), true - switch opCtx.Operation.Operation { - case ast.Query: - return func(ctx context.Context) *graphql.Response { - var response graphql.Response - var data graphql.Marshaler - if first { - first = false - ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, opCtx.Operation.SelectionSet) - } else { - if atomic.LoadInt32(&ec.pendingDeferred) > 0 { - result := <-ec.deferredResults - atomic.AddInt32(&ec.pendingDeferred, -1) - data = result.Result - response.Path = result.Path - response.Label = result.Label - response.Errors = result.Errors - } else { - return nil - } - } - var buf bytes.Buffer - data.MarshalGQL(&buf) - response.Data = buf.Bytes() - if atomic.LoadInt32(&ec.deferred) > 0 { - hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 - response.HasNext = &hasNext - } + case "PageInfo.hasPreviousPage": + if e.complexity.PageInfo.HasPreviousPage == nil { + break + } - return &response + return e.complexity.PageInfo.HasPreviousPage(childComplexity), true + + case "PageInfo.startCursor": + if e.complexity.PageInfo.StartCursor == nil { + break } - case ast.Mutation: - return func(ctx context.Context) *graphql.Response { - if !first { - return nil - } - first = false - ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return &graphql.Response{ - Data: buf.Bytes(), - } + return e.complexity.PageInfo.StartCursor(childComplexity), true + + case "Position.createdAt": + if e.complexity.Position.CreatedAt == nil { + break } - default: - return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) - } -} + return e.complexity.Position.CreatedAt(childComplexity), true -type executionContext struct { - *graphql.OperationContext - *executableSchema - deferred int32 - pendingDeferred int32 - deferredResults chan graphql.DeferredResult -} + case "Position.departmentId": + if e.complexity.Position.DepartmentID == nil { + break + } -func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { - atomic.AddInt32(&ec.pendingDeferred, 1) - go func() { - ctx := graphql.WithFreshResponseContext(dg.Context) - dg.FieldSet.Dispatch(ctx) - ds := graphql.DeferredResult{ - Path: dg.Path, - Label: dg.Label, - Result: dg.FieldSet, - Errors: graphql.GetErrors(ctx), + return e.complexity.Position.DepartmentID(childComplexity), true + + case "Position.description": + if e.complexity.Position.Description == nil { + break } - // null fields should bubble up - if dg.FieldSet.Invalids > 0 { - ds.Result = graphql.Null + + return e.complexity.Position.Description(childComplexity), true + + case "Position.id": + if e.complexity.Position.ID == nil { + break } - ec.deferredResults <- ds - }() -} -func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") - } - return introspection.WrapSchema(ec.Schema()), nil -} + return e.complexity.Position.ID(childComplexity), true -func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") - } - return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil -} + case "Position.maxSalary": + if e.complexity.Position.MaxSalary == nil { + break + } -var sources = []*ast.Source{ - {Name: "../../../../api/graphql/employee.graphqls", Input: `# Employee types and inputs + return e.complexity.Position.MaxSalary(childComplexity), true -type Employee { - id: ID! - user: User! - employeeCode: String! - department: String! - position: String! - hireDate: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented - salary: Float! - status: String! - createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented - updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented -} + case "Position.minSalary": + if e.complexity.Position.MinSalary == nil { + break + } -type EmployeeConnection { - edges: [EmployeeEdge!]! - pageInfo: PageInfo! -} + return e.complexity.Position.MinSalary(childComplexity), true -type EmployeeEdge { - node: Employee! - cursor: String! -} + case "Position.requirements": + if e.complexity.Position.Requirements == nil { + break + } -input CreateEmployeeInput { - userId: ID! - employeeCode: String! - department: String! - position: String! - hireDate: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented - salary: Float! - status: String! -} + return e.complexity.Position.Requirements(childComplexity), true -input UpdateEmployeeInput { - employeeCode: String - department: String - position: String - hireDate: String # TODO: Change to Time scalar when custom scalar marshaling is implemented - salary: Float - status: String -} + case "Position.title": + if e.complexity.Position.Title == nil { + break + } -type CreateEmployeePayload { - employee: Employee! - errors: [Error!] -} + return e.complexity.Position.Title(childComplexity), true -type UpdateEmployeePayload { - employee: Employee! - errors: [Error!] -} + case "Position.updatedAt": + if e.complexity.Position.UpdatedAt == nil { + break + } -type DeleteEmployeePayload { - success: Boolean! - errors: [Error!] -}`, BuiltIn: false}, - {Name: "../../../../api/graphql/mutation.graphqls", Input: `# User and Employee mutations + return e.complexity.Position.UpdatedAt(childComplexity), true -type Mutation { - createUser(input: CreateUserInput!): CreateUserPayload! - updateUser(id: ID!, input: UpdateUserInput!): UpdateUserPayload! - deleteUser(id: ID!): DeleteUserPayload! - createEmployee(input: CreateEmployeeInput!): CreateEmployeePayload! - updateEmployee(id: ID!, input: UpdateEmployeeInput!): UpdateEmployeePayload! - deleteEmployee(id: ID!): DeleteEmployeePayload! -} -`, BuiltIn: false}, - {Name: "../../../../api/graphql/query.graphqls", Input: `# User and Employee queries + case "PositionConnection.edges": + if e.complexity.PositionConnection.Edges == nil { + break + } -type Query { - user(id: ID!): User - users(first: Int, after: String): UserConnection! - employee(id: ID!): Employee - employees(first: Int, after: String): EmployeeConnection! - employeesByDepartment(department: String!, first: Int, after: String): EmployeeConnection! - employeesByStatus(status: String!, first: Int, after: String): EmployeeConnection! -} -`, BuiltIn: false}, - {Name: "../../../../api/graphql/scalars.graphqls", Input: `# Custom scalar definitions + return e.complexity.PositionConnection.Edges(childComplexity), true -# TODO: Implement Time scalar with proper marshaling/unmarshaling -# scalar Time -`, BuiltIn: false}, - {Name: "../../../../api/graphql/user.graphqls", Input: `# User types and inputs + case "PositionConnection.pageInfo": + if e.complexity.PositionConnection.PageInfo == nil { + break + } -type User { - id: ID! - email: String! - name: String! - createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented - updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented -} + return e.complexity.PositionConnection.PageInfo(childComplexity), true -type UserConnection { - edges: [UserEdge!]! - pageInfo: PageInfo! -} + case "PositionEdge.cursor": + if e.complexity.PositionEdge.Cursor == nil { + break + } -type UserEdge { - node: User! - cursor: String! -} + return e.complexity.PositionEdge.Cursor(childComplexity), true -type PageInfo { - hasNextPage: Boolean! - hasPreviousPage: Boolean! - startCursor: String - endCursor: String -} + case "PositionEdge.node": + if e.complexity.PositionEdge.Node == nil { + break + } -input CreateUserInput { - email: String! - name: String! -} + return e.complexity.PositionEdge.Node(childComplexity), true -input UpdateUserInput { - email: String - name: String -} + case "Query.department": + if e.complexity.Query.Department == nil { + break + } -type CreateUserPayload { - user: User! - errors: [Error!] -} + args, err := ec.field_Query_department_args(ctx, rawArgs) + if err != nil { + return 0, false + } -type UpdateUserPayload { - user: User! - errors: [Error!] -} + return e.complexity.Query.Department(childComplexity, args["id"].(string)), true -type DeleteUserPayload { - success: Boolean! - errors: [Error!] -} + case "Query.departments": + if e.complexity.Query.Departments == nil { + break + } -type Error { - message: String! - field: String - code: String -} -`, BuiltIn: false}, -} -var parsedSchema = gqlparser.MustLoadSchema(sources...) + args, err := ec.field_Query_departments_args(ctx, rawArgs) + if err != nil { + return 0, false + } -// endregion ************************** generated!.gotpl ************************** + return e.complexity.Query.Departments(childComplexity, args["first"].(*int), args["after"].(*string)), true -// region ***************************** args.gotpl ***************************** + case "Query.departmentsByManager": + if e.complexity.Query.DepartmentsByManager == nil { + break + } -func (ec *executionContext) field_Mutation_createEmployee_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateEmployeeInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeeInput) - if err != nil { - return nil, err - } - args["input"] = arg0 - return args, nil -} + args, err := ec.field_Query_departmentsByManager_args(ctx, rawArgs) + if err != nil { + return 0, false + } -func (ec *executionContext) field_Mutation_createUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateUserInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserInput) - if err != nil { - return nil, err - } - args["input"] = arg0 - return args, nil -} + return e.complexity.Query.DepartmentsByManager(childComplexity, args["managerId"].(string), args["first"].(*int), args["after"].(*string)), true -func (ec *executionContext) field_Mutation_deleteEmployee_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) - if err != nil { - return nil, err - } - args["id"] = arg0 - return args, nil -} + case "Query.employee": + if e.complexity.Query.Employee == nil { + break + } -func (ec *executionContext) field_Mutation_deleteUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) - if err != nil { - return nil, err - } - args["id"] = arg0 - return args, nil -} + args, err := ec.field_Query_employee_args(ctx, rawArgs) + if err != nil { + return 0, false + } -func (ec *executionContext) field_Mutation_updateEmployee_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) - if err != nil { - return nil, err - } - args["id"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateEmployeeInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeeInput) - if err != nil { - return nil, err - } - args["input"] = arg1 - return args, nil -} + return e.complexity.Query.Employee(childComplexity, args["id"].(string)), true -func (ec *executionContext) field_Mutation_updateUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) - if err != nil { - return nil, err - } - args["id"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateUserInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateUserInput) - if err != nil { - return nil, err - } - args["input"] = arg1 - return args, nil -} + case "Query.employees": + if e.complexity.Query.Employees == nil { + break + } -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "name", ec.unmarshalNString2string) - if err != nil { - return nil, err - } - args["name"] = arg0 - return args, nil -} + args, err := ec.field_Query_employees_args(ctx, rawArgs) + if err != nil { + return 0, false + } -func (ec *executionContext) field_Query_employee_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) - if err != nil { - return nil, err - } - args["id"] = arg0 - return args, nil -} + return e.complexity.Query.Employees(childComplexity, args["first"].(*int), args["after"].(*string)), true -func (ec *executionContext) field_Query_employeesByDepartment_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "department", ec.unmarshalNString2string) - if err != nil { - return nil, err - } - args["department"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) - if err != nil { - return nil, err - } + case "Query.employeesByDepartment": + if e.complexity.Query.EmployeesByDepartment == nil { + break + } + + args, err := ec.field_Query_employeesByDepartment_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.EmployeesByDepartment(childComplexity, args["department"].(string), args["first"].(*int), args["after"].(*string)), true + + case "Query.employeesByStatus": + if e.complexity.Query.EmployeesByStatus == nil { + break + } + + args, err := ec.field_Query_employeesByStatus_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.EmployeesByStatus(childComplexity, args["status"].(string), args["first"].(*int), args["after"].(*string)), true + + case "Query.leave": + if e.complexity.Query.Leave == nil { + break + } + + args, err := ec.field_Query_leave_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Leave(childComplexity, args["id"].(string)), true + + case "Query.leaves": + if e.complexity.Query.Leaves == nil { + break + } + + args, err := ec.field_Query_leaves_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Leaves(childComplexity, args["first"].(*int), args["after"].(*string)), true + + case "Query.leavesByEmployee": + if e.complexity.Query.LeavesByEmployee == nil { + break + } + + args, err := ec.field_Query_leavesByEmployee_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.LeavesByEmployee(childComplexity, args["employeeId"].(string), args["first"].(*int), args["after"].(*string)), true + + case "Query.leavesByStatus": + if e.complexity.Query.LeavesByStatus == nil { + break + } + + args, err := ec.field_Query_leavesByStatus_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.LeavesByStatus(childComplexity, args["status"].(string), args["first"].(*int), args["after"].(*string)), true + + case "Query.position": + if e.complexity.Query.Position == nil { + break + } + + args, err := ec.field_Query_position_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Position(childComplexity, args["id"].(string)), true + + case "Query.positions": + if e.complexity.Query.Positions == nil { + break + } + + args, err := ec.field_Query_positions_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Positions(childComplexity, args["first"].(*int), args["after"].(*string)), true + + case "Query.positionsByDepartment": + if e.complexity.Query.PositionsByDepartment == nil { + break + } + + args, err := ec.field_Query_positionsByDepartment_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.PositionsByDepartment(childComplexity, args["departmentId"].(string), args["first"].(*int), args["after"].(*string)), true + + case "Query.user": + if e.complexity.Query.User == nil { + break + } + + args, err := ec.field_Query_user_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.User(childComplexity, args["id"].(string)), true + + case "Query.users": + if e.complexity.Query.Users == nil { + break + } + + args, err := ec.field_Query_users_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Users(childComplexity, args["first"].(*int), args["after"].(*string)), true + + case "RejectLeavePayload.errors": + if e.complexity.RejectLeavePayload.Errors == nil { + break + } + + return e.complexity.RejectLeavePayload.Errors(childComplexity), true + + case "RejectLeavePayload.leave": + if e.complexity.RejectLeavePayload.Leave == nil { + break + } + + return e.complexity.RejectLeavePayload.Leave(childComplexity), true + + case "UpdateDepartmentPayload.department": + if e.complexity.UpdateDepartmentPayload.Department == nil { + break + } + + return e.complexity.UpdateDepartmentPayload.Department(childComplexity), true + + case "UpdateDepartmentPayload.errors": + if e.complexity.UpdateDepartmentPayload.Errors == nil { + break + } + + return e.complexity.UpdateDepartmentPayload.Errors(childComplexity), true + + case "UpdateEmployeePayload.employee": + if e.complexity.UpdateEmployeePayload.Employee == nil { + break + } + + return e.complexity.UpdateEmployeePayload.Employee(childComplexity), true + + case "UpdateEmployeePayload.errors": + if e.complexity.UpdateEmployeePayload.Errors == nil { + break + } + + return e.complexity.UpdateEmployeePayload.Errors(childComplexity), true + + case "UpdateLeavePayload.errors": + if e.complexity.UpdateLeavePayload.Errors == nil { + break + } + + return e.complexity.UpdateLeavePayload.Errors(childComplexity), true + + case "UpdateLeavePayload.leave": + if e.complexity.UpdateLeavePayload.Leave == nil { + break + } + + return e.complexity.UpdateLeavePayload.Leave(childComplexity), true + + case "UpdatePositionPayload.errors": + if e.complexity.UpdatePositionPayload.Errors == nil { + break + } + + return e.complexity.UpdatePositionPayload.Errors(childComplexity), true + + case "UpdatePositionPayload.position": + if e.complexity.UpdatePositionPayload.Position == nil { + break + } + + return e.complexity.UpdatePositionPayload.Position(childComplexity), true + + case "UpdateUserPayload.errors": + if e.complexity.UpdateUserPayload.Errors == nil { + break + } + + return e.complexity.UpdateUserPayload.Errors(childComplexity), true + + case "UpdateUserPayload.user": + if e.complexity.UpdateUserPayload.User == nil { + break + } + + return e.complexity.UpdateUserPayload.User(childComplexity), true + + case "User.createdAt": + if e.complexity.User.CreatedAt == nil { + break + } + + return e.complexity.User.CreatedAt(childComplexity), true + + case "User.email": + if e.complexity.User.Email == nil { + break + } + + return e.complexity.User.Email(childComplexity), true + + case "User.id": + if e.complexity.User.ID == nil { + break + } + + return e.complexity.User.ID(childComplexity), true + + case "User.name": + if e.complexity.User.Name == nil { + break + } + + return e.complexity.User.Name(childComplexity), true + + case "User.updatedAt": + if e.complexity.User.UpdatedAt == nil { + break + } + + return e.complexity.User.UpdatedAt(childComplexity), true + + case "UserConnection.edges": + if e.complexity.UserConnection.Edges == nil { + break + } + + return e.complexity.UserConnection.Edges(childComplexity), true + + case "UserConnection.pageInfo": + if e.complexity.UserConnection.PageInfo == nil { + break + } + + return e.complexity.UserConnection.PageInfo(childComplexity), true + + case "UserEdge.cursor": + if e.complexity.UserEdge.Cursor == nil { + break + } + + return e.complexity.UserEdge.Cursor(childComplexity), true + + case "UserEdge.node": + if e.complexity.UserEdge.Node == nil { + break + } + + return e.complexity.UserEdge.Node(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputApproveLeaveInput, + ec.unmarshalInputCreateDepartmentInput, + ec.unmarshalInputCreateEmployeeInput, + ec.unmarshalInputCreateLeaveInput, + ec.unmarshalInputCreatePositionInput, + ec.unmarshalInputCreateUserInput, + ec.unmarshalInputUpdateDepartmentInput, + ec.unmarshalInputUpdateEmployeeInput, + ec.unmarshalInputUpdateLeaveInput, + ec.unmarshalInputUpdatePositionInput, + ec.unmarshalInputUpdateUserInput, + ) + first := true + + switch opCtx.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.pendingDeferred) > 0 { + result := <-ec.deferredResults + atomic.AddInt32(&ec.pendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.OperationContext + *executableSchema + deferred int32 + pendingDeferred int32 + deferredResults chan graphql.DeferredResult +} + +func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { + atomic.AddInt32(&ec.pendingDeferred, 1) + go func() { + ctx := graphql.WithFreshResponseContext(dg.Context) + dg.FieldSet.Dispatch(ctx) + ds := graphql.DeferredResult{ + Path: dg.Path, + Label: dg.Label, + Result: dg.FieldSet, + Errors: graphql.GetErrors(ctx), + } + // null fields should bubble up + if dg.FieldSet.Invalids > 0 { + ds.Result = graphql.Null + } + ec.deferredResults <- ds + }() +} + +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(ec.Schema()), nil +} + +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil +} + +var sources = []*ast.Source{ + {Name: "../../../../api/graphql/department.graphqls", Input: `# Department types and inputs + +type Department { + id: ID! + name: String! + description: String! + managerId: ID + createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented +} + +type DepartmentConnection { + edges: [DepartmentEdge!]! + pageInfo: PageInfo! +} + +type DepartmentEdge { + node: Department! + cursor: String! +} + +input CreateDepartmentInput { + name: String! + description: String! + managerId: ID +} + +input UpdateDepartmentInput { + name: String + description: String + managerId: ID +} + +type CreateDepartmentPayload { + department: Department! + errors: [Error!] +} + +type UpdateDepartmentPayload { + department: Department! + errors: [Error!] +} + +type DeleteDepartmentPayload { + success: Boolean! + errors: [Error!] +}`, BuiltIn: false}, + {Name: "../../../../api/graphql/employee.graphqls", Input: `# Employee types and inputs + +type Employee { + id: ID! + user: User! + employeeCode: String! + department: String! + position: String! + hireDate: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + salary: Float! + status: String! + createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented +} + +type EmployeeConnection { + edges: [EmployeeEdge!]! + pageInfo: PageInfo! +} + +type EmployeeEdge { + node: Employee! + cursor: String! +} + +input CreateEmployeeInput { + userId: ID! + employeeCode: String! + department: String! + position: String! + hireDate: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + salary: Float! + status: String! +} + +input UpdateEmployeeInput { + employeeCode: String + department: String + position: String + hireDate: String # TODO: Change to Time scalar when custom scalar marshaling is implemented + salary: Float + status: String +} + +type CreateEmployeePayload { + employee: Employee! + errors: [Error!] +} + +type UpdateEmployeePayload { + employee: Employee! + errors: [Error!] +} + +type DeleteEmployeePayload { + success: Boolean! + errors: [Error!] +}`, BuiltIn: false}, + {Name: "../../../../api/graphql/leave.graphqls", Input: `# Leave types and inputs + +type Leave { + id: ID! + employeeId: ID! + leaveType: String! + startDate: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + endDate: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + reason: String! + status: String! + approvedBy: ID + approvedAt: String # TODO: Change to Time scalar when custom scalar marshaling is implemented + createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented +} + +type LeaveConnection { + edges: [LeaveEdge!]! + pageInfo: PageInfo! +} + +type LeaveEdge { + node: Leave! + cursor: String! +} + +input CreateLeaveInput { + employeeId: ID! + leaveType: String! + startDate: String! + endDate: String! + reason: String! +} + +input UpdateLeaveInput { + leaveType: String + startDate: String + endDate: String + reason: String +} + +input ApproveLeaveInput { + approvedBy: ID! +} + +type CreateLeavePayload { + leave: Leave! + errors: [Error!] +} + +type UpdateLeavePayload { + leave: Leave! + errors: [Error!] +} + +type ApproveLeavePayload { + leave: Leave! + errors: [Error!] +} + +type RejectLeavePayload { + leave: Leave! + errors: [Error!] +} + +type CancelLeavePayload { + leave: Leave! + errors: [Error!] +} + +type DeleteLeavePayload { + success: Boolean! + errors: [Error!] +}`, BuiltIn: false}, + {Name: "../../../../api/graphql/mutation.graphqls", Input: `# User, Employee, Department, Position, and Leave mutations + +type Mutation { + createUser(input: CreateUserInput!): CreateUserPayload! + updateUser(id: ID!, input: UpdateUserInput!): UpdateUserPayload! + deleteUser(id: ID!): DeleteUserPayload! + createEmployee(input: CreateEmployeeInput!): CreateEmployeePayload! + updateEmployee(id: ID!, input: UpdateEmployeeInput!): UpdateEmployeePayload! + deleteEmployee(id: ID!): DeleteEmployeePayload! + createDepartment(input: CreateDepartmentInput!): CreateDepartmentPayload! + updateDepartment(id: ID!, input: UpdateDepartmentInput!): UpdateDepartmentPayload! + deleteDepartment(id: ID!): DeleteDepartmentPayload! + createPosition(input: CreatePositionInput!): CreatePositionPayload! + updatePosition(id: ID!, input: UpdatePositionInput!): UpdatePositionPayload! + deletePosition(id: ID!): DeletePositionPayload! + createLeave(input: CreateLeaveInput!): CreateLeavePayload! + updateLeave(id: ID!, input: UpdateLeaveInput!): UpdateLeavePayload! + approveLeave(id: ID!, input: ApproveLeaveInput!): ApproveLeavePayload! + rejectLeave(id: ID!, input: ApproveLeaveInput!): RejectLeavePayload! + cancelLeave(id: ID!): CancelLeavePayload! + deleteLeave(id: ID!): DeleteLeavePayload! +} +`, BuiltIn: false}, + {Name: "../../../../api/graphql/position.graphqls", Input: `# Position types and inputs + +type Position { + id: ID! + title: String! + description: String! + departmentId: ID + requirements: String! + minSalary: Float! + maxSalary: Float! + createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented +} + +type PositionConnection { + edges: [PositionEdge!]! + pageInfo: PageInfo! +} + +type PositionEdge { + node: Position! + cursor: String! +} + +input CreatePositionInput { + title: String! + description: String! + departmentId: ID + requirements: String! + minSalary: Float! + maxSalary: Float! +} + +input UpdatePositionInput { + title: String + description: String + departmentId: ID + requirements: String + minSalary: Float + maxSalary: Float +} + +type CreatePositionPayload { + position: Position! + errors: [Error!] +} + +type UpdatePositionPayload { + position: Position! + errors: [Error!] +} + +type DeletePositionPayload { + success: Boolean! + errors: [Error!] +}`, BuiltIn: false}, + {Name: "../../../../api/graphql/query.graphqls", Input: `# User, Employee, Department, Position, and Leave queries + +type Query { + user(id: ID!): User + users(first: Int, after: String): UserConnection! + employee(id: ID!): Employee + employees(first: Int, after: String): EmployeeConnection! + employeesByDepartment(department: String!, first: Int, after: String): EmployeeConnection! + employeesByStatus(status: String!, first: Int, after: String): EmployeeConnection! + department(id: ID!): Department + departments(first: Int, after: String): DepartmentConnection! + departmentsByManager(managerId: ID!, first: Int, after: String): DepartmentConnection! + position(id: ID!): Position + positions(first: Int, after: String): PositionConnection! + positionsByDepartment(departmentId: ID!, first: Int, after: String): PositionConnection! + leave(id: ID!): Leave + leaves(first: Int, after: String): LeaveConnection! + leavesByEmployee(employeeId: ID!, first: Int, after: String): LeaveConnection! + leavesByStatus(status: String!, first: Int, after: String): LeaveConnection! +} +`, BuiltIn: false}, + {Name: "../../../../api/graphql/scalars.graphqls", Input: `# Custom scalar definitions + +# TODO: Implement Time scalar with proper marshaling/unmarshaling +# scalar Time +`, BuiltIn: false}, + {Name: "../../../../api/graphql/user.graphqls", Input: `# User types and inputs + +type User { + id: ID! + email: String! + name: String! + createdAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented + updatedAt: String! # TODO: Change to Time scalar when custom scalar marshaling is implemented +} + +type UserConnection { + edges: [UserEdge!]! + pageInfo: PageInfo! +} + +type UserEdge { + node: User! + cursor: String! +} + +type PageInfo { + hasNextPage: Boolean! + hasPreviousPage: Boolean! + startCursor: String + endCursor: String +} + +input CreateUserInput { + email: String! + name: String! +} + +input UpdateUserInput { + email: String + name: String +} + +type CreateUserPayload { + user: User! + errors: [Error!] +} + +type UpdateUserPayload { + user: User! + errors: [Error!] +} + +type DeleteUserPayload { + success: Boolean! + errors: [Error!] +} + +type Error { + message: String! + field: String + code: String +} +`, BuiltIn: false}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) field_Mutation_approveLeave_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNApproveLeaveInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐApproveLeaveInput) + if err != nil { + return nil, err + } + args["input"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_cancelLeave_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createDepartment_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateDepartmentInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateDepartmentInput) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createEmployee_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateEmployeeInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeeInput) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createLeave_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateLeaveInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateLeaveInput) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createPosition_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreatePositionInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreatePositionInput) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateUserInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserInput) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteDepartment_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteEmployee_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteLeave_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deletePosition_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_rejectLeave_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNApproveLeaveInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐApproveLeaveInput) + if err != nil { + return nil, err + } + args["input"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateDepartment_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateDepartmentInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateDepartmentInput) + if err != nil { + return nil, err + } + args["input"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateEmployee_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateEmployeeInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeeInput) + if err != nil { + return nil, err + } + args["input"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateLeave_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateLeaveInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateLeaveInput) + if err != nil { + return nil, err + } + args["input"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updatePosition_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdatePositionInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdatePositionInput) + if err != nil { + return nil, err + } + args["input"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateUserInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateUserInput) + if err != nil { + return nil, err + } + args["input"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "name", ec.unmarshalNString2string) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_department_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_departmentsByManager_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "managerId", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["managerId"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_departments_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_employee_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_employeesByDepartment_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "department", ec.unmarshalNString2string) + if err != nil { + return nil, err + } + args["department"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_employeesByStatus_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "status", ec.unmarshalNString2string) + if err != nil { + return nil, err + } + args["status"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_employees_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_leave_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_leavesByEmployee_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "employeeId", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["employeeId"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_leavesByStatus_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "status", ec.unmarshalNString2string) + if err != nil { + return nil, err + } + args["status"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_leaves_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_position_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_positionsByDepartment_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "departmentId", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["departmentId"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } args["first"] = arg1 arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) if err != nil { - return nil, err + return nil, err + } + args["after"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_positions_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_users_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + if err != nil { + return nil, err + } + args["after"] = arg1 + return args, nil +} + +func (ec *executionContext) field___Directive_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2ᚖbool) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Field_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2ᚖbool) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2bool) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2bool) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _ApproveLeavePayload_leave(ctx context.Context, field graphql.CollectedField, obj *model.ApproveLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ApproveLeavePayload_leave(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Leave, nil + }) + 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.Leave) + fc.Result = res + return ec.marshalNLeave2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeave(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ApproveLeavePayload_leave(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ApproveLeavePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Leave_id(ctx, field) + case "employeeId": + return ec.fieldContext_Leave_employeeId(ctx, field) + case "leaveType": + return ec.fieldContext_Leave_leaveType(ctx, field) + case "startDate": + return ec.fieldContext_Leave_startDate(ctx, field) + case "endDate": + return ec.fieldContext_Leave_endDate(ctx, field) + case "reason": + return ec.fieldContext_Leave_reason(ctx, field) + case "status": + return ec.fieldContext_Leave_status(ctx, field) + case "approvedBy": + return ec.fieldContext_Leave_approvedBy(ctx, field) + case "approvedAt": + return ec.fieldContext_Leave_approvedAt(ctx, field) + case "createdAt": + return ec.fieldContext_Leave_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Leave_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Leave", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ApproveLeavePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.ApproveLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ApproveLeavePayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ApproveLeavePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ApproveLeavePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CancelLeavePayload_leave(ctx context.Context, field graphql.CollectedField, obj *model.CancelLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CancelLeavePayload_leave(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Leave, nil + }) + 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.Leave) + fc.Result = res + return ec.marshalNLeave2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeave(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CancelLeavePayload_leave(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CancelLeavePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Leave_id(ctx, field) + case "employeeId": + return ec.fieldContext_Leave_employeeId(ctx, field) + case "leaveType": + return ec.fieldContext_Leave_leaveType(ctx, field) + case "startDate": + return ec.fieldContext_Leave_startDate(ctx, field) + case "endDate": + return ec.fieldContext_Leave_endDate(ctx, field) + case "reason": + return ec.fieldContext_Leave_reason(ctx, field) + case "status": + return ec.fieldContext_Leave_status(ctx, field) + case "approvedBy": + return ec.fieldContext_Leave_approvedBy(ctx, field) + case "approvedAt": + return ec.fieldContext_Leave_approvedAt(ctx, field) + case "createdAt": + return ec.fieldContext_Leave_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Leave_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Leave", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CancelLeavePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.CancelLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CancelLeavePayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CancelLeavePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CancelLeavePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreateDepartmentPayload_department(ctx context.Context, field graphql.CollectedField, obj *model.CreateDepartmentPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateDepartmentPayload_department(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Department, nil + }) + 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.Department) + fc.Result = res + return ec.marshalNDepartment2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateDepartmentPayload_department(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateDepartmentPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Department_id(ctx, field) + case "name": + return ec.fieldContext_Department_name(ctx, field) + case "description": + return ec.fieldContext_Department_description(ctx, field) + case "managerId": + return ec.fieldContext_Department_managerId(ctx, field) + case "createdAt": + return ec.fieldContext_Department_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Department_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Department", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreateDepartmentPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.CreateDepartmentPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateDepartmentPayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateDepartmentPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateDepartmentPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreateEmployeePayload_employee(ctx context.Context, field graphql.CollectedField, obj *model.CreateEmployeePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateEmployeePayload_employee(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Employee, nil + }) + 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.Employee) + fc.Result = res + return ec.marshalNEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateEmployeePayload_employee(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateEmployeePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Employee_id(ctx, field) + case "user": + return ec.fieldContext_Employee_user(ctx, field) + case "employeeCode": + return ec.fieldContext_Employee_employeeCode(ctx, field) + case "department": + return ec.fieldContext_Employee_department(ctx, field) + case "position": + return ec.fieldContext_Employee_position(ctx, field) + case "hireDate": + return ec.fieldContext_Employee_hireDate(ctx, field) + case "salary": + return ec.fieldContext_Employee_salary(ctx, field) + case "status": + return ec.fieldContext_Employee_status(ctx, field) + case "createdAt": + return ec.fieldContext_Employee_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Employee_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Employee", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreateEmployeePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.CreateEmployeePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateEmployeePayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateEmployeePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateEmployeePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreateLeavePayload_leave(ctx context.Context, field graphql.CollectedField, obj *model.CreateLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateLeavePayload_leave(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Leave, nil + }) + 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.Leave) + fc.Result = res + return ec.marshalNLeave2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeave(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateLeavePayload_leave(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateLeavePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Leave_id(ctx, field) + case "employeeId": + return ec.fieldContext_Leave_employeeId(ctx, field) + case "leaveType": + return ec.fieldContext_Leave_leaveType(ctx, field) + case "startDate": + return ec.fieldContext_Leave_startDate(ctx, field) + case "endDate": + return ec.fieldContext_Leave_endDate(ctx, field) + case "reason": + return ec.fieldContext_Leave_reason(ctx, field) + case "status": + return ec.fieldContext_Leave_status(ctx, field) + case "approvedBy": + return ec.fieldContext_Leave_approvedBy(ctx, field) + case "approvedAt": + return ec.fieldContext_Leave_approvedAt(ctx, field) + case "createdAt": + return ec.fieldContext_Leave_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Leave_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Leave", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreateLeavePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.CreateLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateLeavePayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateLeavePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateLeavePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreatePositionPayload_position(ctx context.Context, field graphql.CollectedField, obj *model.CreatePositionPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreatePositionPayload_position(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Position, nil + }) + 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.Position) + fc.Result = res + return ec.marshalNPosition2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPosition(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreatePositionPayload_position(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreatePositionPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Position_id(ctx, field) + case "title": + return ec.fieldContext_Position_title(ctx, field) + case "description": + return ec.fieldContext_Position_description(ctx, field) + case "departmentId": + return ec.fieldContext_Position_departmentId(ctx, field) + case "requirements": + return ec.fieldContext_Position_requirements(ctx, field) + case "minSalary": + return ec.fieldContext_Position_minSalary(ctx, field) + case "maxSalary": + return ec.fieldContext_Position_maxSalary(ctx, field) + case "createdAt": + return ec.fieldContext_Position_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Position_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Position", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreatePositionPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.CreatePositionPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreatePositionPayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreatePositionPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreatePositionPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreateUserPayload_user(ctx context.Context, field graphql.CollectedField, obj *model.CreateUserPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateUserPayload_user(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.User, nil + }) + 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.User) + fc.Result = res + return ec.marshalNUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateUserPayload_user(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateUserPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "createdAt": + return ec.fieldContext_User_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_User_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CreateUserPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.CreateUserPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateUserPayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateUserPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateUserPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DeleteDepartmentPayload_success(ctx context.Context, field graphql.CollectedField, obj *model.DeleteDepartmentPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteDepartmentPayload_success(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Success, nil + }) + 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeleteDepartmentPayload_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteDepartmentPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DeleteDepartmentPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.DeleteDepartmentPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteDepartmentPayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeleteDepartmentPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteDepartmentPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DeleteEmployeePayload_success(ctx context.Context, field graphql.CollectedField, obj *model.DeleteEmployeePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteEmployeePayload_success(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Success, nil + }) + 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeleteEmployeePayload_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteEmployeePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DeleteEmployeePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.DeleteEmployeePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteEmployeePayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeleteEmployeePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteEmployeePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DeleteLeavePayload_success(ctx context.Context, field graphql.CollectedField, obj *model.DeleteLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteLeavePayload_success(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Success, nil + }) + 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeleteLeavePayload_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteLeavePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DeleteLeavePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.DeleteLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteLeavePayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeleteLeavePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteLeavePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DeletePositionPayload_success(ctx context.Context, field graphql.CollectedField, obj *model.DeletePositionPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeletePositionPayload_success(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Success, nil + }) + 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeletePositionPayload_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeletePositionPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DeletePositionPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.DeletePositionPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeletePositionPayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeletePositionPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeletePositionPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DeleteUserPayload_success(ctx context.Context, field graphql.CollectedField, obj *model.DeleteUserPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteUserPayload_success(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Success, nil + }) + 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeleteUserPayload_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteUserPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DeleteUserPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.DeleteUserPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteUserPayload_errors(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Errors, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DeleteUserPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteUserPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Department_id(ctx context.Context, field graphql.CollectedField, obj *model.Department) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Department_id(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Department_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Department", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Department_name(ctx context.Context, field graphql.CollectedField, obj *model.Department) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Department_name(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Department_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Department", + 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) _Department_description(ctx context.Context, field graphql.CollectedField, obj *model.Department) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Department_description(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Department_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Department", + 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) _Department_managerId(ctx context.Context, field graphql.CollectedField, obj *model.Department) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Department_managerId(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ManagerID, 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.marshalOID2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Department_managerId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Department", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Department_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Department) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Department_createdAt(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Department_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Department", + 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) _Department_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Department) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Department_updatedAt(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Department_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Department", + 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) _DepartmentConnection_edges(ctx context.Context, field graphql.CollectedField, obj *model.DepartmentConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DepartmentConnection_edges(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, nil + }) + 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.DepartmentEdge) + fc.Result = res + return ec.marshalNDepartmentEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartmentEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DepartmentConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DepartmentConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_DepartmentEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_DepartmentEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DepartmentEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DepartmentConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.DepartmentConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DepartmentConnection_pageInfo(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, nil + }) + 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.PageInfo) + fc.Result = res + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DepartmentConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DepartmentConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DepartmentEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.DepartmentEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DepartmentEdge_node(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + 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.Department) + fc.Result = res + return ec.marshalNDepartment2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DepartmentEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DepartmentEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Department_id(ctx, field) + case "name": + return ec.fieldContext_Department_name(ctx, field) + case "description": + return ec.fieldContext_Department_description(ctx, field) + case "managerId": + return ec.fieldContext_Department_managerId(ctx, field) + case "createdAt": + return ec.fieldContext_Department_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Department_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Department", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DepartmentEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.DepartmentEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DepartmentEdge_cursor(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DepartmentEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DepartmentEdge", + 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) _Employee_id(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_id(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Employee_user(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_user(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.User, nil + }) + 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.User) + fc.Result = res + return ec.marshalNUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_user(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "createdAt": + return ec.fieldContext_User_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_User_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Employee_employeeCode(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_employeeCode(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.EmployeeCode, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_employeeCode(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + 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) _Employee_department(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_department(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Department, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_department(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + 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) _Employee_position(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_position(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Position, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_position(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + 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) _Employee_hireDate(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_hireDate(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.HireDate, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_hireDate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + 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) _Employee_salary(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_salary(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Salary, nil + }) + 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.(float64) + fc.Result = res + return ec.marshalNFloat2float64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_salary(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Float does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Employee_status(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_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) (any, 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 { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + 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) _Employee_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_createdAt(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + 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) _Employee_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Employee_updatedAt(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Employee_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Employee", + 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) _EmployeeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *model.EmployeeConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_EmployeeConnection_edges(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, nil + }) + 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.EmployeeEdge) + fc.Result = res + return ec.marshalNEmployeeEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_EmployeeConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EmployeeConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_EmployeeEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_EmployeeEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EmployeeEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _EmployeeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.EmployeeConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_EmployeeConnection_pageInfo(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, nil + }) + 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.PageInfo) + fc.Result = res + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_EmployeeConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EmployeeConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _EmployeeEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.EmployeeEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_EmployeeEdge_node(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + 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.Employee) + fc.Result = res + return ec.marshalNEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_EmployeeEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EmployeeEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Employee_id(ctx, field) + case "user": + return ec.fieldContext_Employee_user(ctx, field) + case "employeeCode": + return ec.fieldContext_Employee_employeeCode(ctx, field) + case "department": + return ec.fieldContext_Employee_department(ctx, field) + case "position": + return ec.fieldContext_Employee_position(ctx, field) + case "hireDate": + return ec.fieldContext_Employee_hireDate(ctx, field) + case "salary": + return ec.fieldContext_Employee_salary(ctx, field) + case "status": + return ec.fieldContext_Employee_status(ctx, field) + case "createdAt": + return ec.fieldContext_Employee_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Employee_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Employee", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _EmployeeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.EmployeeEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_EmployeeEdge_cursor(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_EmployeeEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EmployeeEdge", + 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) _Error_message(ctx context.Context, field graphql.CollectedField, obj *model.Error) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Error_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) (any, 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 { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Error_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Error", + 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) _Error_field(ctx context.Context, field graphql.CollectedField, obj *model.Error) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Error_field(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Field, 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_Error_field(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Error", + 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) _Error_code(ctx context.Context, field graphql.CollectedField, obj *model.Error) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Error_code(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Code, 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_Error_code(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Error", + 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) _Leave_id(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_id(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Leave_employeeId(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_employeeId(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.EmployeeID, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_employeeId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Leave_leaveType(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_leaveType(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.LeaveType, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_leaveType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + 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) _Leave_startDate(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_startDate(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.StartDate, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_startDate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + 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) _Leave_endDate(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_endDate(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.EndDate, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_endDate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + 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) _Leave_reason(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_reason(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Reason, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + 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) _Leave_status(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_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) (any, 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 { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + 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) _Leave_approvedBy(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_approvedBy(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ApprovedBy, 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.marshalOID2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_approvedBy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Leave_approvedAt(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_approvedAt(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ApprovedAt, 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_Leave_approvedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + 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) _Leave_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_createdAt(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + 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) _Leave_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Leave) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Leave_updatedAt(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Leave_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Leave", + 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) _LeaveConnection_edges(ctx context.Context, field graphql.CollectedField, obj *model.LeaveConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LeaveConnection_edges(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, nil + }) + 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.LeaveEdge) + fc.Result = res + return ec.marshalNLeaveEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeaveEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LeaveConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LeaveConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_LeaveEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_LeaveEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type LeaveEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _LeaveConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.LeaveConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LeaveConnection_pageInfo(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, nil + }) + 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.PageInfo) + fc.Result = res + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LeaveConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LeaveConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _LeaveEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.LeaveEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LeaveEdge_node(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + 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.Leave) + fc.Result = res + return ec.marshalNLeave2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeave(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LeaveEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LeaveEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Leave_id(ctx, field) + case "employeeId": + return ec.fieldContext_Leave_employeeId(ctx, field) + case "leaveType": + return ec.fieldContext_Leave_leaveType(ctx, field) + case "startDate": + return ec.fieldContext_Leave_startDate(ctx, field) + case "endDate": + return ec.fieldContext_Leave_endDate(ctx, field) + case "reason": + return ec.fieldContext_Leave_reason(ctx, field) + case "status": + return ec.fieldContext_Leave_status(ctx, field) + case "approvedBy": + return ec.fieldContext_Leave_approvedBy(ctx, field) + case "approvedAt": + return ec.fieldContext_Leave_approvedAt(ctx, field) + case "createdAt": + return ec.fieldContext_Leave_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Leave_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Leave", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _LeaveEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.LeaveEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LeaveEdge_cursor(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LeaveEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LeaveEdge", + 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) _Mutation_createUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createUser(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateUser(rctx, fc.Args["input"].(model.CreateUserInput)) + }) + 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.CreateUserPayload) + fc.Result = res + return ec.marshalNCreateUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createUser(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 "user": + return ec.fieldContext_CreateUserPayload_user(ctx, field) + case "errors": + return ec.fieldContext_CreateUserPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateUserPayload", 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_createUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateUser(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateUser(rctx, fc.Args["id"].(string), fc.Args["input"].(model.UpdateUserInput)) + }) + 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.UpdateUserPayload) + fc.Result = res + return ec.marshalNUpdateUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateUserPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateUser(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 "user": + return ec.fieldContext_UpdateUserPayload_user(ctx, field) + case "errors": + return ec.fieldContext_UpdateUserPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateUserPayload", 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_updateUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteUser(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteUser(rctx, fc.Args["id"].(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.DeleteUserPayload) + fc.Result = res + return ec.marshalNDeleteUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteUserPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteUser(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 "success": + return ec.fieldContext_DeleteUserPayload_success(ctx, field) + case "errors": + return ec.fieldContext_DeleteUserPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteUserPayload", 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_deleteUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createEmployee(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createEmployee(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateEmployee(rctx, fc.Args["input"].(model.CreateEmployeeInput)) + }) + 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.CreateEmployeePayload) + fc.Result = res + return ec.marshalNCreateEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createEmployee(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 "employee": + return ec.fieldContext_CreateEmployeePayload_employee(ctx, field) + case "errors": + return ec.fieldContext_CreateEmployeePayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateEmployeePayload", 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_createEmployee_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateEmployee(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateEmployee(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateEmployee(rctx, fc.Args["id"].(string), fc.Args["input"].(model.UpdateEmployeeInput)) + }) + 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.UpdateEmployeePayload) + fc.Result = res + return ec.marshalNUpdateEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateEmployee(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 "employee": + return ec.fieldContext_UpdateEmployeePayload_employee(ctx, field) + case "errors": + return ec.fieldContext_UpdateEmployeePayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateEmployeePayload", 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_updateEmployee_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteEmployee(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteEmployee(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteEmployee(rctx, fc.Args["id"].(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.DeleteEmployeePayload) + fc.Result = res + return ec.marshalNDeleteEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteEmployeePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteEmployee(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 "success": + return ec.fieldContext_DeleteEmployeePayload_success(ctx, field) + case "errors": + return ec.fieldContext_DeleteEmployeePayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteEmployeePayload", 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_deleteEmployee_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createDepartment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createDepartment(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateDepartment(rctx, fc.Args["input"].(model.CreateDepartmentInput)) + }) + 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.CreateDepartmentPayload) + fc.Result = res + return ec.marshalNCreateDepartmentPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateDepartmentPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createDepartment(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 "department": + return ec.fieldContext_CreateDepartmentPayload_department(ctx, field) + case "errors": + return ec.fieldContext_CreateDepartmentPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateDepartmentPayload", 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_createDepartment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateDepartment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateDepartment(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateDepartment(rctx, fc.Args["id"].(string), fc.Args["input"].(model.UpdateDepartmentInput)) + }) + 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.UpdateDepartmentPayload) + fc.Result = res + return ec.marshalNUpdateDepartmentPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateDepartmentPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateDepartment(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 "department": + return ec.fieldContext_UpdateDepartmentPayload_department(ctx, field) + case "errors": + return ec.fieldContext_UpdateDepartmentPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateDepartmentPayload", 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_updateDepartment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteDepartment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteDepartment(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteDepartment(rctx, fc.Args["id"].(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.DeleteDepartmentPayload) + fc.Result = res + return ec.marshalNDeleteDepartmentPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteDepartmentPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteDepartment(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 "success": + return ec.fieldContext_DeleteDepartmentPayload_success(ctx, field) + case "errors": + return ec.fieldContext_DeleteDepartmentPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteDepartmentPayload", 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_deleteDepartment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createPosition(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createPosition(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreatePosition(rctx, fc.Args["input"].(model.CreatePositionInput)) + }) + 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.CreatePositionPayload) + fc.Result = res + return ec.marshalNCreatePositionPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreatePositionPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createPosition(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 "position": + return ec.fieldContext_CreatePositionPayload_position(ctx, field) + case "errors": + return ec.fieldContext_CreatePositionPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreatePositionPayload", 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_createPosition_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updatePosition(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updatePosition(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdatePosition(rctx, fc.Args["id"].(string), fc.Args["input"].(model.UpdatePositionInput)) + }) + 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.UpdatePositionPayload) + fc.Result = res + return ec.marshalNUpdatePositionPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdatePositionPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updatePosition(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 "position": + return ec.fieldContext_UpdatePositionPayload_position(ctx, field) + case "errors": + return ec.fieldContext_UpdatePositionPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdatePositionPayload", 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_updatePosition_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deletePosition(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deletePosition(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeletePosition(rctx, fc.Args["id"].(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.DeletePositionPayload) + fc.Result = res + return ec.marshalNDeletePositionPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeletePositionPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deletePosition(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 "success": + return ec.fieldContext_DeletePositionPayload_success(ctx, field) + case "errors": + return ec.fieldContext_DeletePositionPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeletePositionPayload", 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_deletePosition_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createLeave(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createLeave(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateLeave(rctx, fc.Args["input"].(model.CreateLeaveInput)) + }) + 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.CreateLeavePayload) + fc.Result = res + return ec.marshalNCreateLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateLeavePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createLeave(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 "leave": + return ec.fieldContext_CreateLeavePayload_leave(ctx, field) + case "errors": + return ec.fieldContext_CreateLeavePayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateLeavePayload", 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_createLeave_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateLeave(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateLeave(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateLeave(rctx, fc.Args["id"].(string), fc.Args["input"].(model.UpdateLeaveInput)) + }) + 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.UpdateLeavePayload) + fc.Result = res + return ec.marshalNUpdateLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateLeavePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateLeave(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 "leave": + return ec.fieldContext_UpdateLeavePayload_leave(ctx, field) + case "errors": + return ec.fieldContext_UpdateLeavePayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateLeavePayload", 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_updateLeave_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_approveLeave(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_approveLeave(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ApproveLeave(rctx, fc.Args["id"].(string), fc.Args["input"].(model.ApproveLeaveInput)) + }) + 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.ApproveLeavePayload) + fc.Result = res + return ec.marshalNApproveLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐApproveLeavePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_approveLeave(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 "leave": + return ec.fieldContext_ApproveLeavePayload_leave(ctx, field) + case "errors": + return ec.fieldContext_ApproveLeavePayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApproveLeavePayload", 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_approveLeave_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_rejectLeave(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_rejectLeave(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RejectLeave(rctx, fc.Args["id"].(string), fc.Args["input"].(model.ApproveLeaveInput)) + }) + 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.RejectLeavePayload) + fc.Result = res + return ec.marshalNRejectLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐRejectLeavePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_rejectLeave(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 "leave": + return ec.fieldContext_RejectLeavePayload_leave(ctx, field) + case "errors": + return ec.fieldContext_RejectLeavePayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RejectLeavePayload", 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_rejectLeave_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_cancelLeave(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_cancelLeave(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CancelLeave(rctx, fc.Args["id"].(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.CancelLeavePayload) + fc.Result = res + return ec.marshalNCancelLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCancelLeavePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_cancelLeave(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 "leave": + return ec.fieldContext_CancelLeavePayload_leave(ctx, field) + case "errors": + return ec.fieldContext_CancelLeavePayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CancelLeavePayload", 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_cancelLeave_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteLeave(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteLeave(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteLeave(rctx, fc.Args["id"].(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.DeleteLeavePayload) + fc.Result = res + return ec.marshalNDeleteLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteLeavePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteLeave(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 "success": + return ec.fieldContext_DeleteLeavePayload_success(ctx, field) + case "errors": + return ec.fieldContext_DeleteLeavePayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteLeavePayload", 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_deleteLeave_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_hasNextPage(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.HasNextPage, nil + }) + 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PageInfo", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_hasPreviousPage(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.HasPreviousPage, nil + }) + 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PageInfo", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_startCursor(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.StartCursor, 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_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PageInfo", + 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) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_endCursor(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.EndCursor, 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_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PageInfo", + 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) _Position_id(ctx context.Context, field graphql.CollectedField, obj *model.Position) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Position_id(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Position_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Position", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Position_title(ctx context.Context, field graphql.CollectedField, obj *model.Position) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Position_title(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Position_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Position", + 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) _Position_description(ctx context.Context, field graphql.CollectedField, obj *model.Position) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Position_description(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Position_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Position", + 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) _Position_departmentId(ctx context.Context, field graphql.CollectedField, obj *model.Position) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Position_departmentId(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.DepartmentID, 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.marshalOID2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Position_departmentId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Position", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Position_requirements(ctx context.Context, field graphql.CollectedField, obj *model.Position) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Position_requirements(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Requirements, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Position_requirements(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Position", + 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) _Position_minSalary(ctx context.Context, field graphql.CollectedField, obj *model.Position) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Position_minSalary(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.MinSalary, nil + }) + 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.(float64) + fc.Result = res + return ec.marshalNFloat2float64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Position_minSalary(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Position", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Float does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Position_maxSalary(ctx context.Context, field graphql.CollectedField, obj *model.Position) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Position_maxSalary(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.MaxSalary, nil + }) + 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.(float64) + fc.Result = res + return ec.marshalNFloat2float64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Position_maxSalary(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Position", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Float does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Position_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Position) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Position_createdAt(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Position_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Position", + 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) _Position_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Position) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Position_updatedAt(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Position_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Position", + 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) _PositionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *model.PositionConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PositionConnection_edges(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, nil + }) + 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.PositionEdge) + fc.Result = res + return ec.marshalNPositionEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPositionEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PositionConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PositionConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_PositionEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_PositionEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PositionEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _PositionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.PositionConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PositionConnection_pageInfo(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, nil + }) + 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.PageInfo) + fc.Result = res + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PositionConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PositionConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _PositionEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.PositionEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PositionEdge_node(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + 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.Position) + fc.Result = res + return ec.marshalNPosition2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPosition(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PositionEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PositionEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Position_id(ctx, field) + case "title": + return ec.fieldContext_Position_title(ctx, field) + case "description": + return ec.fieldContext_Position_description(ctx, field) + case "departmentId": + return ec.fieldContext_Position_departmentId(ctx, field) + case "requirements": + return ec.fieldContext_Position_requirements(ctx, field) + case "minSalary": + return ec.fieldContext_Position_minSalary(ctx, field) + case "maxSalary": + return ec.fieldContext_Position_maxSalary(ctx, field) + case "createdAt": + return ec.fieldContext_Position_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Position_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Position", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _PositionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.PositionEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PositionEdge_cursor(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PositionEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PositionEdge", + 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) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_user(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().User(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.User) + fc.Result = res + return ec.marshalOUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_user(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 "id": + return ec.fieldContext_User_id(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "createdAt": + return ec.fieldContext_User_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_User_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", 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_user_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_users(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_users(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Users(rctx, fc.Args["first"].(*int), fc.Args["after"].(*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.UserConnection) + fc.Result = res + return ec.marshalNUserConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUserConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_users(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 "edges": + return ec.fieldContext_UserConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_UserConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserConnection", field.Name) + }, } - args["after"] = arg2 - return args, nil + 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_users_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil } -func (ec *executionContext) field_Query_employeesByStatus_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "status", ec.unmarshalNString2string) +func (ec *executionContext) _Query_employee(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_employee(ctx, field) if err != nil { - return nil, err + return graphql.Null } - args["status"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + 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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Employee(rctx, fc.Args["id"].(string)) + }) if err != nil { - return nil, err + ec.Error(ctx, err) + return graphql.Null } - args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) - if err != nil { - return nil, err + if resTmp == nil { + return graphql.Null } - args["after"] = arg2 - return args, nil + res := resTmp.(*model.Employee) + fc.Result = res + return ec.marshalOEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx, field.Selections, res) } -func (ec *executionContext) field_Query_employees_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) +func (ec *executionContext) fieldContext_Query_employee(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 "id": + return ec.fieldContext_Employee_id(ctx, field) + case "user": + return ec.fieldContext_Employee_user(ctx, field) + case "employeeCode": + return ec.fieldContext_Employee_employeeCode(ctx, field) + case "department": + return ec.fieldContext_Employee_department(ctx, field) + case "position": + return ec.fieldContext_Employee_position(ctx, field) + case "hireDate": + return ec.fieldContext_Employee_hireDate(ctx, field) + case "salary": + return ec.fieldContext_Employee_salary(ctx, field) + case "status": + return ec.fieldContext_Employee_status(ctx, field) + case "createdAt": + return ec.fieldContext_Employee_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Employee_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Employee", 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_employee_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_employees(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_employees(ctx, field) if err != nil { - return nil, err + return graphql.Null } - args["first"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + 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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Employees(rctx, fc.Args["first"].(*int), fc.Args["after"].(*string)) + }) if err != nil { - return nil, err + ec.Error(ctx, err) + return graphql.Null } - args["after"] = arg1 - return args, nil + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.EmployeeConnection) + fc.Result = res + return ec.marshalNEmployeeConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx, field.Selections, res) } -func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2string) +func (ec *executionContext) fieldContext_Query_employees(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 "edges": + return ec.fieldContext_EmployeeConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_EmployeeConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EmployeeConnection", 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_employees_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_employeesByDepartment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_employeesByDepartment(ctx, field) if err != nil { - return nil, err + return graphql.Null } - args["id"] = arg0 - return args, nil + 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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().EmployeesByDepartment(rctx, fc.Args["department"].(string), fc.Args["first"].(*int), fc.Args["after"].(*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.EmployeeConnection) + fc.Result = res + return ec.marshalNEmployeeConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx, field.Selections, res) } -func (ec *executionContext) field_Query_users_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) +func (ec *executionContext) fieldContext_Query_employeesByDepartment(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 "edges": + return ec.fieldContext_EmployeeConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_EmployeeConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EmployeeConnection", 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_employeesByDepartment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_employeesByStatus(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_employeesByStatus(ctx, field) if err != nil { - return nil, err + return graphql.Null } - args["first"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + 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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().EmployeesByStatus(rctx, fc.Args["status"].(string), fc.Args["first"].(*int), fc.Args["after"].(*string)) + }) if err != nil { - return nil, err + 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 } - args["after"] = arg1 - return args, nil + res := resTmp.(*model.EmployeeConnection) + fc.Result = res + return ec.marshalNEmployeeConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx, field.Selections, res) } -func (ec *executionContext) field___Directive_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2ᚖbool) - if err != nil { - return nil, err +func (ec *executionContext) fieldContext_Query_employeesByStatus(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 "edges": + return ec.fieldContext_EmployeeConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_EmployeeConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EmployeeConnection", field.Name) + }, } - args["includeDeprecated"] = arg0 - return args, nil + 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_employeesByStatus_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil } -func (ec *executionContext) field___Field_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2ᚖbool) +func (ec *executionContext) _Query_department(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_department(ctx, field) if err != nil { - return nil, err + return graphql.Null } - args["includeDeprecated"] = arg0 - return args, nil -} - -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2bool) + 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) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Department(rctx, fc.Args["id"].(string)) + }) if err != nil { - return nil, err + ec.Error(ctx, err) + return graphql.Null } - args["includeDeprecated"] = arg0 - return args, nil + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.Department) + fc.Result = res + return ec.marshalODepartment2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartment(ctx, field.Selections, res) } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { - var err error - args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2bool) - if err != nil { - return nil, err +func (ec *executionContext) fieldContext_Query_department(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 "id": + return ec.fieldContext_Department_id(ctx, field) + case "name": + return ec.fieldContext_Department_name(ctx, field) + case "description": + return ec.fieldContext_Department_description(ctx, field) + case "managerId": + return ec.fieldContext_Department_managerId(ctx, field) + case "createdAt": + return ec.fieldContext_Department_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Department_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Department", field.Name) + }, } - args["includeDeprecated"] = arg0 - return args, nil + 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_department_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil } -// endregion ***************************** args.gotpl ***************************** - -// region ************************** directives.gotpl ************************** - -// endregion ************************** directives.gotpl ************************** - -// region **************************** field.gotpl ***************************** - -func (ec *executionContext) _CreateEmployeePayload_employee(ctx context.Context, field graphql.CollectedField, obj *model.CreateEmployeePayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_CreateEmployeePayload_employee(ctx, field) +func (ec *executionContext) _Query_departments(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_departments(ctx, field) if err != nil { return graphql.Null } @@ -1131,7 +8056,7 @@ func (ec *executionContext) _CreateEmployeePayload_employee(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Employee, nil + return ec.resolvers.Query().Departments(rctx, fc.Args["first"].(*int), fc.Args["after"].(*string)) }) if err != nil { ec.Error(ctx, err) @@ -1143,48 +8068,43 @@ func (ec *executionContext) _CreateEmployeePayload_employee(ctx context.Context, } return graphql.Null } - res := resTmp.(*model.Employee) + res := resTmp.(*model.DepartmentConnection) fc.Result = res - return ec.marshalNEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx, field.Selections, res) + return ec.marshalNDepartmentConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartmentConnection(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_CreateEmployeePayload_employee(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_departments(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "CreateEmployeePayload", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Employee_id(ctx, field) - case "user": - return ec.fieldContext_Employee_user(ctx, field) - case "employeeCode": - return ec.fieldContext_Employee_employeeCode(ctx, field) - case "department": - return ec.fieldContext_Employee_department(ctx, field) - case "position": - return ec.fieldContext_Employee_position(ctx, field) - case "hireDate": - return ec.fieldContext_Employee_hireDate(ctx, field) - case "salary": - return ec.fieldContext_Employee_salary(ctx, field) - case "status": - return ec.fieldContext_Employee_status(ctx, field) - case "createdAt": - return ec.fieldContext_Employee_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Employee_updatedAt(ctx, field) + case "edges": + return ec.fieldContext_DepartmentConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_DepartmentConnection_pageInfo(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Employee", field.Name) + return nil, fmt.Errorf("no field named %q was found under type DepartmentConnection", 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_departments_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _CreateEmployeePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.CreateEmployeePayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_CreateEmployeePayload_errors(ctx, field) +func (ec *executionContext) _Query_departmentsByManager(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_departmentsByManager(ctx, field) if err != nil { return graphql.Null } @@ -1197,43 +8117,55 @@ func (ec *executionContext) _CreateEmployeePayload_errors(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Errors, nil + return ec.resolvers.Query().DepartmentsByManager(rctx, fc.Args["managerId"].(string), fc.Args["first"].(*int), fc.Args["after"].(*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.Error) + res := resTmp.(*model.DepartmentConnection) fc.Result = res - return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) + return ec.marshalNDepartmentConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartmentConnection(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_CreateEmployeePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_departmentsByManager(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "CreateEmployeePayload", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "message": - return ec.fieldContext_Error_message(ctx, field) - case "field": - return ec.fieldContext_Error_field(ctx, field) - case "code": - return ec.fieldContext_Error_code(ctx, field) + case "edges": + return ec.fieldContext_DepartmentConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_DepartmentConnection_pageInfo(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + return nil, fmt.Errorf("no field named %q was found under type DepartmentConnection", 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_departmentsByManager_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _CreateUserPayload_user(ctx context.Context, field graphql.CollectedField, obj *model.CreateUserPayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_CreateUserPayload_user(ctx, field) +func (ec *executionContext) _Query_position(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_position(ctx, field) if err != nil { return graphql.Null } @@ -1246,50 +8178,66 @@ func (ec *executionContext) _CreateUserPayload_user(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.User, nil + return ec.resolvers.Query().Position(rctx, fc.Args["id"].(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.User) + res := resTmp.(*model.Position) fc.Result = res - return ec.marshalNUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) + return ec.marshalOPosition2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPosition(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_CreateUserPayload_user(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_position(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "CreateUserPayload", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_User_id(ctx, field) - case "email": - return ec.fieldContext_User_email(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) + return ec.fieldContext_Position_id(ctx, field) + case "title": + return ec.fieldContext_Position_title(ctx, field) + case "description": + return ec.fieldContext_Position_description(ctx, field) + case "departmentId": + return ec.fieldContext_Position_departmentId(ctx, field) + case "requirements": + return ec.fieldContext_Position_requirements(ctx, field) + case "minSalary": + return ec.fieldContext_Position_minSalary(ctx, field) + case "maxSalary": + return ec.fieldContext_Position_maxSalary(ctx, field) case "createdAt": - return ec.fieldContext_User_createdAt(ctx, field) + return ec.fieldContext_Position_createdAt(ctx, field) case "updatedAt": - return ec.fieldContext_User_updatedAt(ctx, field) + return ec.fieldContext_Position_updatedAt(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Position", 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_position_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _CreateUserPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.CreateUserPayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_CreateUserPayload_errors(ctx, field) +func (ec *executionContext) _Query_positions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_positions(ctx, field) if err != nil { return graphql.Null } @@ -1302,43 +8250,55 @@ func (ec *executionContext) _CreateUserPayload_errors(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Errors, nil + return ec.resolvers.Query().Positions(rctx, fc.Args["first"].(*int), fc.Args["after"].(*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.Error) + res := resTmp.(*model.PositionConnection) fc.Result = res - return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) + return ec.marshalNPositionConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPositionConnection(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_CreateUserPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_positions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "CreateUserPayload", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "message": - return ec.fieldContext_Error_message(ctx, field) - case "field": - return ec.fieldContext_Error_field(ctx, field) - case "code": - return ec.fieldContext_Error_code(ctx, field) + case "edges": + return ec.fieldContext_PositionConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_PositionConnection_pageInfo(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PositionConnection", 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_positions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _DeleteEmployeePayload_success(ctx context.Context, field graphql.CollectedField, obj *model.DeleteEmployeePayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DeleteEmployeePayload_success(ctx, field) +func (ec *executionContext) _Query_positionsByDepartment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_positionsByDepartment(ctx, field) if err != nil { return graphql.Null } @@ -1351,7 +8311,7 @@ func (ec *executionContext) _DeleteEmployeePayload_success(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Success, nil + return ec.resolvers.Query().PositionsByDepartment(rctx, fc.Args["departmentId"].(string), fc.Args["first"].(*int), fc.Args["after"].(*string)) }) if err != nil { ec.Error(ctx, err) @@ -1363,26 +8323,43 @@ func (ec *executionContext) _DeleteEmployeePayload_success(ctx context.Context, } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*model.PositionConnection) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNPositionConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPositionConnection(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DeleteEmployeePayload_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_positionsByDepartment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DeleteEmployeePayload", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_PositionConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_PositionConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PositionConnection", 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_positionsByDepartment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _DeleteEmployeePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.DeleteEmployeePayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DeleteEmployeePayload_errors(ctx, field) +func (ec *executionContext) _Query_leave(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_leave(ctx, field) if err != nil { return graphql.Null } @@ -1395,7 +8372,7 @@ func (ec *executionContext) _DeleteEmployeePayload_errors(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Errors, nil + return ec.resolvers.Query().Leave(rctx, fc.Args["id"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -1404,34 +8381,61 @@ func (ec *executionContext) _DeleteEmployeePayload_errors(ctx context.Context, f if resTmp == nil { return graphql.Null } - res := resTmp.([]*model.Error) + res := resTmp.(*model.Leave) fc.Result = res - return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) + return ec.marshalOLeave2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeave(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DeleteEmployeePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_leave(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DeleteEmployeePayload", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "message": - return ec.fieldContext_Error_message(ctx, field) - case "field": - return ec.fieldContext_Error_field(ctx, field) - case "code": - return ec.fieldContext_Error_code(ctx, field) + case "id": + return ec.fieldContext_Leave_id(ctx, field) + case "employeeId": + return ec.fieldContext_Leave_employeeId(ctx, field) + case "leaveType": + return ec.fieldContext_Leave_leaveType(ctx, field) + case "startDate": + return ec.fieldContext_Leave_startDate(ctx, field) + case "endDate": + return ec.fieldContext_Leave_endDate(ctx, field) + case "reason": + return ec.fieldContext_Leave_reason(ctx, field) + case "status": + return ec.fieldContext_Leave_status(ctx, field) + case "approvedBy": + return ec.fieldContext_Leave_approvedBy(ctx, field) + case "approvedAt": + return ec.fieldContext_Leave_approvedAt(ctx, field) + case "createdAt": + return ec.fieldContext_Leave_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Leave_updatedAt(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Leave", 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_leave_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _DeleteUserPayload_success(ctx context.Context, field graphql.CollectedField, obj *model.DeleteUserPayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DeleteUserPayload_success(ctx, field) +func (ec *executionContext) _Query_leaves(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_leaves(ctx, field) if err != nil { return graphql.Null } @@ -1444,7 +8448,7 @@ func (ec *executionContext) _DeleteUserPayload_success(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Success, nil + return ec.resolvers.Query().Leaves(rctx, fc.Args["first"].(*int), fc.Args["after"].(*string)) }) if err != nil { ec.Error(ctx, err) @@ -1456,26 +8460,43 @@ func (ec *executionContext) _DeleteUserPayload_success(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*model.LeaveConnection) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNLeaveConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeaveConnection(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DeleteUserPayload_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_leaves(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DeleteUserPayload", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_LeaveConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_LeaveConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type LeaveConnection", 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_leaves_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _DeleteUserPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.DeleteUserPayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DeleteUserPayload_errors(ctx, field) +func (ec *executionContext) _Query_leavesByEmployee(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_leavesByEmployee(ctx, field) if err != nil { return graphql.Null } @@ -1488,43 +8509,55 @@ func (ec *executionContext) _DeleteUserPayload_errors(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Errors, nil + return ec.resolvers.Query().LeavesByEmployee(rctx, fc.Args["employeeId"].(string), fc.Args["first"].(*int), fc.Args["after"].(*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.Error) + res := resTmp.(*model.LeaveConnection) fc.Result = res - return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) + return ec.marshalNLeaveConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeaveConnection(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DeleteUserPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_leavesByEmployee(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DeleteUserPayload", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "message": - return ec.fieldContext_Error_message(ctx, field) - case "field": - return ec.fieldContext_Error_field(ctx, field) - case "code": - return ec.fieldContext_Error_code(ctx, field) + case "edges": + return ec.fieldContext_LeaveConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_LeaveConnection_pageInfo(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + return nil, fmt.Errorf("no field named %q was found under type LeaveConnection", 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_leavesByEmployee_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Employee_id(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_id(ctx, field) +func (ec *executionContext) _Query_leavesByStatus(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_leavesByStatus(ctx, field) if err != nil { return graphql.Null } @@ -1537,7 +8570,7 @@ func (ec *executionContext) _Employee_id(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.ID, nil + return ec.resolvers.Query().LeavesByStatus(rctx, fc.Args["status"].(string), fc.Args["first"].(*int), fc.Args["after"].(*string)) }) if err != nil { ec.Error(ctx, err) @@ -1549,26 +8582,43 @@ func (ec *executionContext) _Employee_id(ctx context.Context, field graphql.Coll } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.LeaveConnection) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNLeaveConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeaveConnection(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_leavesByStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_LeaveConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_LeaveConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type LeaveConnection", 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_leavesByStatus_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Employee_user(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_user(ctx, field) +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { return graphql.Null } @@ -1581,50 +8631,70 @@ func (ec *executionContext) _Employee_user(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.User, nil + return ec.introspectType(fc.Args["name"].(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.User) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalNUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_user(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "email": - return ec.fieldContext_User_email(ctx, field) + case "kind": + return ec.fieldContext___Type_kind(ctx, field) case "name": - return ec.fieldContext_User_name(ctx, field) - case "createdAt": - return ec.fieldContext_User_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_User_updatedAt(ctx, field) + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, fmt.Errorf("no field named %q was found under type __Type", 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___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Employee_employeeCode(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_employeeCode(ctx, field) +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(ctx, field) if err != nil { return graphql.Null } @@ -1637,38 +8707,49 @@ func (ec *executionContext) _Employee_employeeCode(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.EmployeeCode, nil + return ec.introspectSchema() }) 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.(string) + res := resTmp.(*introspection.Schema) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_employeeCode(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, 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") + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) }, } return fc, nil } - -func (ec *executionContext) _Employee_department(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_department(ctx, field) + +func (ec *executionContext) _RejectLeavePayload_leave(ctx context.Context, field graphql.CollectedField, obj *model.RejectLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RejectLeavePayload_leave(ctx, field) if err != nil { return graphql.Null } @@ -1681,7 +8762,7 @@ func (ec *executionContext) _Employee_department(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Department, nil + return obj.Leave, nil }) if err != nil { ec.Error(ctx, err) @@ -1693,26 +8774,50 @@ func (ec *executionContext) _Employee_department(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.Leave) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNLeave2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeave(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_department(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RejectLeavePayload_leave(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "RejectLeavePayload", 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") + switch field.Name { + case "id": + return ec.fieldContext_Leave_id(ctx, field) + case "employeeId": + return ec.fieldContext_Leave_employeeId(ctx, field) + case "leaveType": + return ec.fieldContext_Leave_leaveType(ctx, field) + case "startDate": + return ec.fieldContext_Leave_startDate(ctx, field) + case "endDate": + return ec.fieldContext_Leave_endDate(ctx, field) + case "reason": + return ec.fieldContext_Leave_reason(ctx, field) + case "status": + return ec.fieldContext_Leave_status(ctx, field) + case "approvedBy": + return ec.fieldContext_Leave_approvedBy(ctx, field) + case "approvedAt": + return ec.fieldContext_Leave_approvedAt(ctx, field) + case "createdAt": + return ec.fieldContext_Leave_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Leave_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Leave", field.Name) }, } return fc, nil } -func (ec *executionContext) _Employee_position(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_position(ctx, field) +func (ec *executionContext) _RejectLeavePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.RejectLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RejectLeavePayload_errors(ctx, field) if err != nil { return graphql.Null } @@ -1725,38 +8830,43 @@ func (ec *executionContext) _Employee_position(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Position, nil + return obj.Errors, nil }) 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.(string) + res := resTmp.([]*model.Error) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_position(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RejectLeavePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "RejectLeavePayload", 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") + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) }, } return fc, nil } -func (ec *executionContext) _Employee_hireDate(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_hireDate(ctx, field) +func (ec *executionContext) _UpdateDepartmentPayload_department(ctx context.Context, field graphql.CollectedField, obj *model.UpdateDepartmentPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateDepartmentPayload_department(ctx, field) if err != nil { return graphql.Null } @@ -1769,7 +8879,7 @@ func (ec *executionContext) _Employee_hireDate(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.HireDate, nil + return obj.Department, nil }) if err != nil { ec.Error(ctx, err) @@ -1781,26 +8891,40 @@ func (ec *executionContext) _Employee_hireDate(ctx context.Context, field graphq } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.Department) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNDepartment2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartment(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_hireDate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdateDepartmentPayload_department(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "UpdateDepartmentPayload", 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") + switch field.Name { + case "id": + return ec.fieldContext_Department_id(ctx, field) + case "name": + return ec.fieldContext_Department_name(ctx, field) + case "description": + return ec.fieldContext_Department_description(ctx, field) + case "managerId": + return ec.fieldContext_Department_managerId(ctx, field) + case "createdAt": + return ec.fieldContext_Department_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Department_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Department", field.Name) }, } return fc, nil } -func (ec *executionContext) _Employee_salary(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_salary(ctx, field) +func (ec *executionContext) _UpdateDepartmentPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.UpdateDepartmentPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateDepartmentPayload_errors(ctx, field) if err != nil { return graphql.Null } @@ -1813,38 +8937,43 @@ func (ec *executionContext) _Employee_salary(ctx context.Context, field graphql. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Salary, nil + return obj.Errors, nil }) 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.(float64) + res := resTmp.([]*model.Error) fc.Result = res - return ec.marshalNFloat2float64(ctx, field.Selections, res) + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_salary(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdateDepartmentPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "UpdateDepartmentPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Float does not have child fields") + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) }, } return fc, nil } -func (ec *executionContext) _Employee_status(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_status(ctx, field) +func (ec *executionContext) _UpdateEmployeePayload_employee(ctx context.Context, field graphql.CollectedField, obj *model.UpdateEmployeePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateEmployeePayload_employee(ctx, field) if err != nil { return graphql.Null } @@ -1857,7 +8986,7 @@ func (ec *executionContext) _Employee_status(ctx context.Context, field graphql. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Status, nil + return obj.Employee, nil }) if err != nil { ec.Error(ctx, err) @@ -1869,26 +8998,48 @@ func (ec *executionContext) _Employee_status(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.Employee) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdateEmployeePayload_employee(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "UpdateEmployeePayload", 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") + switch field.Name { + case "id": + return ec.fieldContext_Employee_id(ctx, field) + case "user": + return ec.fieldContext_Employee_user(ctx, field) + case "employeeCode": + return ec.fieldContext_Employee_employeeCode(ctx, field) + case "department": + return ec.fieldContext_Employee_department(ctx, field) + case "position": + return ec.fieldContext_Employee_position(ctx, field) + case "hireDate": + return ec.fieldContext_Employee_hireDate(ctx, field) + case "salary": + return ec.fieldContext_Employee_salary(ctx, field) + case "status": + return ec.fieldContext_Employee_status(ctx, field) + case "createdAt": + return ec.fieldContext_Employee_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Employee_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Employee", field.Name) }, } return fc, nil } -func (ec *executionContext) _Employee_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_createdAt(ctx, field) +func (ec *executionContext) _UpdateEmployeePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.UpdateEmployeePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateEmployeePayload_errors(ctx, field) if err != nil { return graphql.Null } @@ -1901,38 +9052,43 @@ func (ec *executionContext) _Employee_createdAt(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.CreatedAt, nil + return obj.Errors, nil }) 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.(string) + res := resTmp.([]*model.Error) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdateEmployeePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "UpdateEmployeePayload", 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") + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) }, } return fc, nil } -func (ec *executionContext) _Employee_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Employee) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Employee_updatedAt(ctx, field) +func (ec *executionContext) _UpdateLeavePayload_leave(ctx context.Context, field graphql.CollectedField, obj *model.UpdateLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateLeavePayload_leave(ctx, field) if err != nil { return graphql.Null } @@ -1945,7 +9101,7 @@ func (ec *executionContext) _Employee_updatedAt(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.UpdatedAt, nil + return obj.Leave, nil }) if err != nil { ec.Error(ctx, err) @@ -1957,26 +9113,50 @@ func (ec *executionContext) _Employee_updatedAt(ctx context.Context, field graph } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.Leave) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNLeave2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeave(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Employee_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdateLeavePayload_leave(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Employee", + Object: "UpdateLeavePayload", 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") + switch field.Name { + case "id": + return ec.fieldContext_Leave_id(ctx, field) + case "employeeId": + return ec.fieldContext_Leave_employeeId(ctx, field) + case "leaveType": + return ec.fieldContext_Leave_leaveType(ctx, field) + case "startDate": + return ec.fieldContext_Leave_startDate(ctx, field) + case "endDate": + return ec.fieldContext_Leave_endDate(ctx, field) + case "reason": + return ec.fieldContext_Leave_reason(ctx, field) + case "status": + return ec.fieldContext_Leave_status(ctx, field) + case "approvedBy": + return ec.fieldContext_Leave_approvedBy(ctx, field) + case "approvedAt": + return ec.fieldContext_Leave_approvedAt(ctx, field) + case "createdAt": + return ec.fieldContext_Leave_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Leave_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Leave", field.Name) }, } return fc, nil } -func (ec *executionContext) _EmployeeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *model.EmployeeConnection) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_EmployeeConnection_edges(ctx, field) +func (ec *executionContext) _UpdateLeavePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.UpdateLeavePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateLeavePayload_errors(ctx, field) if err != nil { return graphql.Null } @@ -1989,44 +9169,43 @@ func (ec *executionContext) _EmployeeConnection_edges(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Edges, nil + return obj.Errors, nil }) 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.EmployeeEdge) + res := resTmp.([]*model.Error) fc.Result = res - return ec.marshalNEmployeeEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeEdgeᚄ(ctx, field.Selections, res) + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_EmployeeConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdateLeavePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EmployeeConnection", + Object: "UpdateLeavePayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "node": - return ec.fieldContext_EmployeeEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_EmployeeEdge_cursor(ctx, field) + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type EmployeeEdge", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) }, } return fc, nil } -func (ec *executionContext) _EmployeeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.EmployeeConnection) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_EmployeeConnection_pageInfo(ctx, field) +func (ec *executionContext) _UpdatePositionPayload_position(ctx context.Context, field graphql.CollectedField, obj *model.UpdatePositionPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdatePositionPayload_position(ctx, field) if err != nil { return graphql.Null } @@ -2039,7 +9218,7 @@ func (ec *executionContext) _EmployeeConnection_pageInfo(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.PageInfo, nil + return obj.Position, nil }) if err != nil { ec.Error(ctx, err) @@ -2051,36 +9230,46 @@ func (ec *executionContext) _EmployeeConnection_pageInfo(ctx context.Context, fi } return graphql.Null } - res := resTmp.(*model.PageInfo) + res := resTmp.(*model.Position) fc.Result = res - return ec.marshalNPageInfo2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPosition2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPosition(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_EmployeeConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdatePositionPayload_position(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EmployeeConnection", + Object: "UpdatePositionPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) + case "id": + return ec.fieldContext_Position_id(ctx, field) + case "title": + return ec.fieldContext_Position_title(ctx, field) + case "description": + return ec.fieldContext_Position_description(ctx, field) + case "departmentId": + return ec.fieldContext_Position_departmentId(ctx, field) + case "requirements": + return ec.fieldContext_Position_requirements(ctx, field) + case "minSalary": + return ec.fieldContext_Position_minSalary(ctx, field) + case "maxSalary": + return ec.fieldContext_Position_maxSalary(ctx, field) + case "createdAt": + return ec.fieldContext_Position_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Position_updatedAt(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Position", field.Name) }, } return fc, nil } -func (ec *executionContext) _EmployeeEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.EmployeeEdge) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_EmployeeEdge_node(ctx, field) +func (ec *executionContext) _UpdatePositionPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.UpdatePositionPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdatePositionPayload_errors(ctx, field) if err != nil { return graphql.Null } @@ -2093,60 +9282,43 @@ func (ec *executionContext) _EmployeeEdge_node(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Node, nil + return obj.Errors, nil }) 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.Employee) + res := resTmp.([]*model.Error) fc.Result = res - return ec.marshalNEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx, field.Selections, res) + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_EmployeeEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdatePositionPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EmployeeEdge", + Object: "UpdatePositionPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Employee_id(ctx, field) - case "user": - return ec.fieldContext_Employee_user(ctx, field) - case "employeeCode": - return ec.fieldContext_Employee_employeeCode(ctx, field) - case "department": - return ec.fieldContext_Employee_department(ctx, field) - case "position": - return ec.fieldContext_Employee_position(ctx, field) - case "hireDate": - return ec.fieldContext_Employee_hireDate(ctx, field) - case "salary": - return ec.fieldContext_Employee_salary(ctx, field) - case "status": - return ec.fieldContext_Employee_status(ctx, field) - case "createdAt": - return ec.fieldContext_Employee_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Employee_updatedAt(ctx, field) + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Employee", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) }, } return fc, nil } -func (ec *executionContext) _EmployeeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.EmployeeEdge) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_EmployeeEdge_cursor(ctx, field) +func (ec *executionContext) _UpdateUserPayload_user(ctx context.Context, field graphql.CollectedField, obj *model.UpdateUserPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateUserPayload_user(ctx, field) if err != nil { return graphql.Null } @@ -2159,7 +9331,7 @@ func (ec *executionContext) _EmployeeEdge_cursor(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil + return obj.User, nil }) if err != nil { ec.Error(ctx, err) @@ -2171,26 +9343,38 @@ func (ec *executionContext) _EmployeeEdge_cursor(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.User) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_EmployeeEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdateUserPayload_user(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EmployeeEdge", + Object: "UpdateUserPayload", 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") + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "createdAt": + return ec.fieldContext_User_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_User_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, } return fc, nil } -func (ec *executionContext) _Error_message(ctx context.Context, field graphql.CollectedField, obj *model.Error) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Error_message(ctx, field) +func (ec *executionContext) _UpdateUserPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.UpdateUserPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateUserPayload_errors(ctx, field) if err != nil { return graphql.Null } @@ -2203,38 +9387,43 @@ func (ec *executionContext) _Error_message(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Message, nil + return obj.Errors, nil }) 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.(string) + res := resTmp.([]*model.Error) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Error_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdateUserPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Error", + Object: "UpdateUserPayload", 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") + switch field.Name { + case "message": + return ec.fieldContext_Error_message(ctx, field) + case "field": + return ec.fieldContext_Error_field(ctx, field) + case "code": + return ec.fieldContext_Error_code(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) }, } return fc, nil } -func (ec *executionContext) _Error_field(ctx context.Context, field graphql.CollectedField, obj *model.Error) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Error_field(ctx, field) +func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_id(ctx, field) if err != nil { return graphql.Null } @@ -2247,35 +9436,38 @@ func (ec *executionContext) _Error_field(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Field, nil + return obj.ID, nil }) 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.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Error_field(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Error", + Object: "User", 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 nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Error_code(ctx context.Context, field graphql.CollectedField, obj *model.Error) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Error_code(ctx, field) +func (ec *executionContext) _User_email(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_email(ctx, field) if err != nil { return graphql.Null } @@ -2288,23 +9480,26 @@ func (ec *executionContext) _Error_code(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Code, nil + return obj.Email, nil }) 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.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Error_code(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Error", + Object: "User", Field: field, IsMethod: false, IsResolver: false, @@ -2315,8 +9510,8 @@ func (ec *executionContext) fieldContext_Error_code(_ context.Context, field gra return fc, nil } -func (ec *executionContext) _Mutation_createUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_createUser(ctx, field) +func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_name(ctx, field) if err != nil { return graphql.Null } @@ -2329,7 +9524,7 @@ func (ec *executionContext) _Mutation_createUser(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateUser(rctx, fc.Args["input"].(model.CreateUserInput)) + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -2341,43 +9536,26 @@ func (ec *executionContext) _Mutation_createUser(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(*model.CreateUserPayload) + res := resTmp.(string) fc.Result = res - return ec.marshalNCreateUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserPayload(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_createUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "User", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "user": - return ec.fieldContext_CreateUserPayload_user(ctx, field) - case "errors": - return ec.fieldContext_CreateUserPayload_errors(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CreateUserPayload", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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_createUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_updateUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_updateUser(ctx, field) +func (ec *executionContext) _User_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_createdAt(ctx, field) if err != nil { return graphql.Null } @@ -2390,7 +9568,7 @@ func (ec *executionContext) _Mutation_updateUser(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateUser(rctx, fc.Args["id"].(string), fc.Args["input"].(model.UpdateUserInput)) + return obj.CreatedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -2402,43 +9580,26 @@ func (ec *executionContext) _Mutation_updateUser(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(*model.UpdateUserPayload) + res := resTmp.(string) fc.Result = res - return ec.marshalNUpdateUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateUserPayload(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_updateUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "User", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "user": - return ec.fieldContext_UpdateUserPayload_user(ctx, field) - case "errors": - return ec.fieldContext_UpdateUserPayload_errors(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type UpdateUserPayload", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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_updateUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_deleteUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_deleteUser(ctx, field) +func (ec *executionContext) _User_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_updatedAt(ctx, field) if err != nil { return graphql.Null } @@ -2451,7 +9612,7 @@ func (ec *executionContext) _Mutation_deleteUser(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().DeleteUser(rctx, fc.Args["id"].(string)) + return obj.UpdatedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -2463,43 +9624,26 @@ func (ec *executionContext) _Mutation_deleteUser(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(*model.DeleteUserPayload) + res := resTmp.(string) fc.Result = res - return ec.marshalNDeleteUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteUserPayload(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_deleteUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "User", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "success": - return ec.fieldContext_DeleteUserPayload_success(ctx, field) - case "errors": - return ec.fieldContext_DeleteUserPayload_errors(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DeleteUserPayload", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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_deleteUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_createEmployee(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_createEmployee(ctx, field) +func (ec *executionContext) _UserConnection_edges(ctx context.Context, field graphql.CollectedField, obj *model.UserConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserConnection_edges(ctx, field) if err != nil { return graphql.Null } @@ -2512,7 +9656,7 @@ func (ec *executionContext) _Mutation_createEmployee(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateEmployee(rctx, fc.Args["input"].(model.CreateEmployeeInput)) + return obj.Edges, nil }) if err != nil { ec.Error(ctx, err) @@ -2524,43 +9668,32 @@ func (ec *executionContext) _Mutation_createEmployee(ctx context.Context, field } return graphql.Null } - res := resTmp.(*model.CreateEmployeePayload) + res := resTmp.([]*model.UserEdge) fc.Result = res - return ec.marshalNCreateEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeePayload(ctx, field.Selections, res) + return ec.marshalNUserEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUserEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_createEmployee(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UserConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "UserConnection", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "employee": - return ec.fieldContext_CreateEmployeePayload_employee(ctx, field) - case "errors": - return ec.fieldContext_CreateEmployeePayload_errors(ctx, field) + case "node": + return ec.fieldContext_UserEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_UserEdge_cursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type CreateEmployeePayload", field.Name) + return nil, fmt.Errorf("no field named %q was found under type UserEdge", 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_createEmployee_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_updateEmployee(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_updateEmployee(ctx, field) +func (ec *executionContext) _UserConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.UserConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserConnection_pageInfo(ctx, field) if err != nil { return graphql.Null } @@ -2573,7 +9706,7 @@ func (ec *executionContext) _Mutation_updateEmployee(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateEmployee(rctx, fc.Args["id"].(string), fc.Args["input"].(model.UpdateEmployeeInput)) + return obj.PageInfo, nil }) if err != nil { ec.Error(ctx, err) @@ -2585,43 +9718,36 @@ func (ec *executionContext) _Mutation_updateEmployee(ctx context.Context, field } return graphql.Null } - res := resTmp.(*model.UpdateEmployeePayload) + res := resTmp.(*model.PageInfo) fc.Result = res - return ec.marshalNUpdateEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeePayload(ctx, field.Selections, res) + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_updateEmployee(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UserConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "UserConnection", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "employee": - return ec.fieldContext_UpdateEmployeePayload_employee(ctx, field) - case "errors": - return ec.fieldContext_UpdateEmployeePayload_errors(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type UpdateEmployeePayload", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PageInfo", 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_updateEmployee_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_deleteEmployee(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_deleteEmployee(ctx, field) +func (ec *executionContext) _UserEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.UserEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserEdge_node(ctx, field) if err != nil { return graphql.Null } @@ -2634,7 +9760,7 @@ func (ec *executionContext) _Mutation_deleteEmployee(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().DeleteEmployee(rctx, fc.Args["id"].(string)) + return obj.Node, nil }) if err != nil { ec.Error(ctx, err) @@ -2646,43 +9772,38 @@ func (ec *executionContext) _Mutation_deleteEmployee(ctx context.Context, field } return graphql.Null } - res := resTmp.(*model.DeleteEmployeePayload) + res := resTmp.(*model.User) fc.Result = res - return ec.marshalNDeleteEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteEmployeePayload(ctx, field.Selections, res) + return ec.marshalNUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_deleteEmployee(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UserEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "UserEdge", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "success": - return ec.fieldContext_DeleteEmployeePayload_success(ctx, field) - case "errors": - return ec.fieldContext_DeleteEmployeePayload_errors(ctx, field) + case "id": + return ec.fieldContext_User_id(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "createdAt": + return ec.fieldContext_User_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_User_updatedAt(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type DeleteEmployeePayload", field.Name) + return nil, fmt.Errorf("no field named %q was found under type User", 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_deleteEmployee_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_PageInfo_hasNextPage(ctx, field) +func (ec *executionContext) _UserEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.UserEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserEdge_cursor(ctx, field) if err != nil { return graphql.Null } @@ -2695,7 +9816,7 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.HasNextPage, nil + return obj.Cursor, nil }) if err != nil { ec.Error(ctx, err) @@ -2707,26 +9828,26 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UserEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "UserEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_name(ctx, field) if err != nil { return graphql.Null } @@ -2739,7 +9860,7 @@ func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.HasPreviousPage, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -2751,26 +9872,26 @@ func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_PageInfo_startCursor(ctx, field) +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_description(ctx, field) if err != nil { return graphql.Null } @@ -2783,7 +9904,7 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.StartCursor, nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) @@ -2797,11 +9918,11 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "__Directive", Field: field, - IsMethod: false, + IsMethod: true, 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") @@ -2810,8 +9931,8 @@ func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, return fc, nil } -func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_PageInfo_endCursor(ctx, field) +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) if err != nil { return graphql.Null } @@ -2824,35 +9945,38 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.EndCursor, nil + return obj.IsRepeatable, nil }) 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.(*string) + res := resTmp.(bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "__Directive", 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 nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_user(ctx, field) +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(ctx, field) if err != nil { return graphql.Null } @@ -2865,58 +9989,38 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().User(rctx, fc.Args["id"].(string)) + return obj.Locations, nil }) 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.User) + res := resTmp.([]string) fc.Result = res - return ec.marshalOUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_user(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "__Directive", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "email": - return ec.fieldContext_User_email(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "createdAt": - return ec.fieldContext_User_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_User_updatedAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, errors.New("field of type __DirectiveLocation does not have child fields") }, } - 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_user_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_users(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_users(ctx, field) +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(ctx, field) if err != nil { return graphql.Null } @@ -2929,7 +10033,7 @@ func (ec *executionContext) _Query_users(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Users(rctx, fc.Args["first"].(*int), fc.Args["after"].(*string)) + return obj.Args, nil }) if err != nil { ec.Error(ctx, err) @@ -2941,25 +10045,33 @@ func (ec *executionContext) _Query_users(ctx context.Context, field graphql.Coll } return graphql.Null } - res := resTmp.(*model.UserConnection) + res := resTmp.([]introspection.InputValue) fc.Result = res - return ec.marshalNUserConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUserConnection(ctx, field.Selections, res) + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_users(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "__Directive", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_UserConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_UserConnection_pageInfo(ctx, field) + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type UserConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } defer func() { @@ -2969,15 +10081,15 @@ func (ec *executionContext) fieldContext_Query_users(ctx context.Context, field } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_users_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field___Directive_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Query_employee(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_employee(ctx, field) +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_name(ctx, field) if err != nil { return graphql.Null } @@ -2990,68 +10102,38 @@ func (ec *executionContext) _Query_employee(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Employee(rctx, fc.Args["id"].(string)) + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Employee) - fc.Result = res - return ec.marshalOEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_employee(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 "id": - return ec.fieldContext_Employee_id(ctx, field) - case "user": - return ec.fieldContext_Employee_user(ctx, field) - case "employeeCode": - return ec.fieldContext_Employee_employeeCode(ctx, field) - case "department": - return ec.fieldContext_Employee_department(ctx, field) - case "position": - return ec.fieldContext_Employee_position(ctx, field) - case "hireDate": - return ec.fieldContext_Employee_hireDate(ctx, field) - case "salary": - return ec.fieldContext_Employee_salary(ctx, field) - case "status": - return ec.fieldContext_Employee_status(ctx, field) - case "createdAt": - return ec.fieldContext_Employee_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Employee_updatedAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Employee", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_employee_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + 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) _Query_employees(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_employees(ctx, field) +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_description(ctx, field) if err != nil { return graphql.Null } @@ -3064,55 +10146,35 @@ func (ec *executionContext) _Query_employees(ctx context.Context, field graphql. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Employees(rctx, fc.Args["first"].(*int), fc.Args["after"].(*string)) + return obj.Description(), nil }) 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.EmployeeConnection) + res := resTmp.(*string) fc.Result = res - return ec.marshalNEmployeeConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_employees(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "__EnumValue", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_EmployeeConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_EmployeeConnection_pageInfo(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type EmployeeConnection", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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_employees_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_employeesByDepartment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_employeesByDepartment(ctx, field) +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) if err != nil { return graphql.Null } @@ -3125,7 +10187,7 @@ func (ec *executionContext) _Query_employeesByDepartment(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().EmployeesByDepartment(rctx, fc.Args["department"].(string), fc.Args["first"].(*int), fc.Args["after"].(*string)) + return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) @@ -3137,43 +10199,26 @@ func (ec *executionContext) _Query_employeesByDepartment(ctx context.Context, fi } return graphql.Null } - res := resTmp.(*model.EmployeeConnection) + res := resTmp.(bool) fc.Result = res - return ec.marshalNEmployeeConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_employeesByDepartment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "__EnumValue", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_EmployeeConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_EmployeeConnection_pageInfo(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type EmployeeConnection", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } - 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_employeesByDepartment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_employeesByStatus(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_employeesByStatus(ctx, field) +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) if err != nil { return graphql.Null } @@ -3186,55 +10231,35 @@ func (ec *executionContext) _Query_employeesByStatus(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().EmployeesByStatus(rctx, fc.Args["status"].(string), fc.Args["first"].(*int), fc.Args["after"].(*string)) + return obj.DeprecationReason(), nil }) 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.EmployeeConnection) + res := resTmp.(*string) fc.Result = res - return ec.marshalNEmployeeConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_employeesByStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "__EnumValue", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_EmployeeConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_EmployeeConnection_pageInfo(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type EmployeeConnection", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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_employeesByStatus_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) { - fc, err := ec.fieldContext_Query___type(ctx, field) +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_name(ctx, field) if err != nil { return graphql.Null } @@ -3247,70 +10272,38 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.introspectType(fc.Args["name"].(string)) + return obj.Name, nil }) 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.(*introspection.Type) + res := resTmp.(string) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "__Field", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___schema(ctx, field) +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_description(ctx, field) if err != nil { return graphql.Null } @@ -3323,7 +10316,7 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.introspectSchema() + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) @@ -3332,40 +10325,26 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C if resTmp == nil { return graphql.Null } - res := resTmp.(*introspection.Schema) + res := resTmp.(*string) fc.Result = res - return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "__Field", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "description": - return ec.fieldContext___Schema_description(ctx, field) - case "types": - return ec.fieldContext___Schema_types(ctx, field) - case "queryType": - return ec.fieldContext___Schema_queryType(ctx, field) - case "mutationType": - return ec.fieldContext___Schema_mutationType(ctx, field) - case "subscriptionType": - return ec.fieldContext___Schema_subscriptionType(ctx, field) - case "directives": - return ec.fieldContext___Schema_directives(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _UpdateEmployeePayload_employee(ctx context.Context, field graphql.CollectedField, obj *model.UpdateEmployeePayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UpdateEmployeePayload_employee(ctx, field) +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_args(ctx, field) if err != nil { return graphql.Null } @@ -3378,7 +10357,7 @@ func (ec *executionContext) _UpdateEmployeePayload_employee(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Employee, nil + return obj.Args, nil }) if err != nil { ec.Error(ctx, err) @@ -3390,48 +10369,51 @@ func (ec *executionContext) _UpdateEmployeePayload_employee(ctx context.Context, } return graphql.Null } - res := resTmp.(*model.Employee) + res := resTmp.([]introspection.InputValue) fc.Result = res - return ec.marshalNEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx, field.Selections, res) + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UpdateEmployeePayload_employee(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UpdateEmployeePayload", + Object: "__Field", Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Employee_id(ctx, field) - case "user": - return ec.fieldContext_Employee_user(ctx, field) - case "employeeCode": - return ec.fieldContext_Employee_employeeCode(ctx, field) - case "department": - return ec.fieldContext_Employee_department(ctx, field) - case "position": - return ec.fieldContext_Employee_position(ctx, field) - case "hireDate": - return ec.fieldContext_Employee_hireDate(ctx, field) - case "salary": - return ec.fieldContext_Employee_salary(ctx, field) - case "status": - return ec.fieldContext_Employee_status(ctx, field) - case "createdAt": - return ec.fieldContext_Employee_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Employee_updatedAt(ctx, field) + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Employee", field.Name) + return nil, fmt.Errorf("no field named %q was found under type __InputValue", 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___Field_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _UpdateEmployeePayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.UpdateEmployeePayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UpdateEmployeePayload_errors(ctx, field) +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_type(ctx, field) if err != nil { return graphql.Null } @@ -3444,43 +10426,62 @@ func (ec *executionContext) _UpdateEmployeePayload_errors(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Errors, nil + return obj.Type, nil }) 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.Error) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UpdateEmployeePayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UpdateEmployeePayload", + Object: "__Field", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "message": - return ec.fieldContext_Error_message(ctx, field) - case "field": - return ec.fieldContext_Error_field(ctx, field) - case "code": - return ec.fieldContext_Error_code(ctx, field) + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _UpdateUserPayload_user(ctx context.Context, field graphql.CollectedField, obj *model.UpdateUserPayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UpdateUserPayload_user(ctx, field) +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) if err != nil { return graphql.Null } @@ -3493,7 +10494,7 @@ func (ec *executionContext) _UpdateUserPayload_user(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.User, nil + return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) @@ -3505,38 +10506,26 @@ func (ec *executionContext) _UpdateUserPayload_user(ctx context.Context, field g } return graphql.Null } - res := resTmp.(*model.User) + res := resTmp.(bool) fc.Result = res - return ec.marshalNUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UpdateUserPayload_user(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UpdateUserPayload", + Object: "__Field", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "email": - return ec.fieldContext_User_email(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "createdAt": - return ec.fieldContext_User_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_User_updatedAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _UpdateUserPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.UpdateUserPayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UpdateUserPayload_errors(ctx, field) +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) if err != nil { return graphql.Null } @@ -3549,7 +10538,7 @@ func (ec *executionContext) _UpdateUserPayload_errors(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Errors, nil + return obj.DeprecationReason(), nil }) if err != nil { ec.Error(ctx, err) @@ -3558,34 +10547,26 @@ func (ec *executionContext) _UpdateUserPayload_errors(ctx context.Context, field if resTmp == nil { return graphql.Null } - res := resTmp.([]*model.Error) + res := resTmp.(*string) fc.Result = res - return ec.marshalOError2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐErrorᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UpdateUserPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UpdateUserPayload", + Object: "__Field", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "message": - return ec.fieldContext_Error_message(ctx, field) - case "field": - return ec.fieldContext_Error_field(ctx, field) - case "code": - return ec.fieldContext_Error_code(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Error", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_id(ctx, field) +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_name(ctx, field) if err != nil { return graphql.Null } @@ -3598,7 +10579,7 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.ID, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -3612,24 +10593,24 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } res := resTmp.(string) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "__InputValue", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _User_email(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_email(ctx, field) +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_description(ctx, field) if err != nil { return graphql.Null } @@ -3642,28 +10623,25 @@ func (ec *executionContext) _User_email(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Email, nil + return obj.Description(), nil }) 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.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "__InputValue", Field: field, - IsMethod: false, + IsMethod: true, 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") @@ -3672,8 +10650,8 @@ func (ec *executionContext) fieldContext_User_email(_ context.Context, field gra return fc, nil } -func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_name(ctx, field) +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_type(ctx, field) if err != nil { return graphql.Null } @@ -3686,7 +10664,7 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.Type, nil }) if err != nil { ec.Error(ctx, err) @@ -3698,26 +10676,50 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "__InputValue", 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") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _User_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_createdAt(ctx, field) +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) if err != nil { return graphql.Null } @@ -3730,26 +10732,23 @@ func (ec *executionContext) _User_createdAt(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.CreatedAt, nil + return obj.DefaultValue, nil }) 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.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "__InputValue", Field: field, IsMethod: false, IsResolver: false, @@ -3760,8 +10759,8 @@ func (ec *executionContext) fieldContext_User_createdAt(_ context.Context, field return fc, nil } -func (ec *executionContext) _User_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_updatedAt(ctx, field) +func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_isDeprecated(ctx, field) if err != nil { return graphql.Null } @@ -3774,7 +10773,7 @@ func (ec *executionContext) _User_updatedAt(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.UpdatedAt, nil + return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) @@ -3786,26 +10785,26 @@ func (ec *executionContext) _User_updatedAt(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.(string) + res := resTmp.(bool) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "__InputValue", Field: field, - IsMethod: false, + IsMethod: true, 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 nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _UserConnection_edges(ctx context.Context, field graphql.CollectedField, obj *model.UserConnection) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UserConnection_edges(ctx, field) +func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_deprecationReason(ctx, field) if err != nil { return graphql.Null } @@ -3818,44 +10817,35 @@ func (ec *executionContext) _UserConnection_edges(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Edges, nil + return obj.DeprecationReason(), nil }) 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.UserEdge) + res := resTmp.(*string) fc.Result = res - return ec.marshalNUserEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUserEdgeᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UserConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UserConnection", + Object: "__InputValue", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_UserEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_UserEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type UserEdge", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _UserConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.UserConnection) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UserConnection_pageInfo(ctx, field) +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_description(ctx, field) if err != nil { return graphql.Null } @@ -3868,48 +10858,35 @@ func (ec *executionContext) _UserConnection_pageInfo(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.PageInfo, nil + return obj.Description(), nil }) 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.PageInfo) + res := resTmp.(*string) fc.Result = res - return ec.marshalNPageInfo2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPageInfo(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UserConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UserConnection", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _UserEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.UserEdge) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UserEdge_node(ctx, field) +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_types(ctx, field) if err != nil { return graphql.Null } @@ -3922,7 +10899,7 @@ func (ec *executionContext) _UserEdge_node(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Node, nil + return obj.Types(), nil }) if err != nil { ec.Error(ctx, err) @@ -3934,38 +10911,50 @@ func (ec *executionContext) _UserEdge_node(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.(*model.User) + res := resTmp.([]introspection.Type) fc.Result = res - return ec.marshalNUser2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUser(ctx, field.Selections, res) + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UserEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UserEdge", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "email": - return ec.fieldContext_User_email(ctx, field) + case "kind": + return ec.fieldContext___Type_kind(ctx, field) case "name": - return ec.fieldContext_User_name(ctx, field) - case "createdAt": - return ec.fieldContext_User_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_User_updatedAt(ctx, field) + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _UserEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.UserEdge) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UserEdge_cursor(ctx, field) +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_queryType(ctx, field) if err != nil { return graphql.Null } @@ -3978,7 +10967,7 @@ func (ec *executionContext) _UserEdge_cursor(ctx context.Context, field graphql. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil + return obj.QueryType(), nil }) if err != nil { ec.Error(ctx, err) @@ -3990,26 +10979,50 @@ func (ec *executionContext) _UserEdge_cursor(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UserEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UserEdge", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, 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") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_name(ctx, field) +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_mutationType(ctx, field) if err != nil { return graphql.Null } @@ -4022,38 +11035,59 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.MutationType(), nil }) 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.(string) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, 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") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_description(ctx, field) +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) if err != nil { return graphql.Null } @@ -4066,7 +11100,7 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Description(), nil + return obj.SubscriptionType(), nil }) if err != nil { ec.Error(ctx, err) @@ -4075,26 +11109,50 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "__Schema", Field: field, IsMethod: true, 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") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_directives(ctx, field) if err != nil { return graphql.Null } @@ -4107,7 +11165,7 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.IsRepeatable, nil + return obj.Directives(), nil }) if err != nil { ec.Error(ctx, err) @@ -4119,26 +11177,38 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field } return graphql.Null } - res := resTmp.(bool) + res := resTmp.([]introspection.Directive) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_locations(ctx, field) +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_kind(ctx, field) if err != nil { return graphql.Null } @@ -4151,7 +11221,7 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Locations, nil + return obj.Kind(), nil }) if err != nil { ec.Error(ctx, err) @@ -4163,26 +11233,26 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } return graphql.Null } - res := resTmp.([]string) + res := resTmp.(string) fc.Result = res - return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) + return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __DirectiveLocation does not have child fields") + return nil, errors.New("field of type __TypeKind does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_args(ctx, field) +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_name(ctx, field) if err != nil { return graphql.Null } @@ -4195,63 +11265,35 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Args, nil + return obj.Name(), nil }) 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.([]introspection.InputValue) + res := resTmp.(*string) fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - case "isDeprecated": - return ec.fieldContext___InputValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___InputValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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___Directive_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_name(ctx, field) +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_description(ctx, field) if err != nil { return graphql.Null } @@ -4264,28 +11306,25 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.Description(), nil }) 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.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, 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") @@ -4294,8 +11333,8 @@ func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, fie return fc, nil } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_description(ctx, field) +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) if err != nil { return graphql.Null } @@ -4308,7 +11347,7 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Description(), nil + return obj.SpecifiedByURL(), nil }) if err != nil { ec.Error(ctx, err) @@ -4322,9 +11361,9 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "__Type", Field: field, IsMethod: true, IsResolver: false, @@ -4335,8 +11374,8 @@ func (ec *executionContext) fieldContext___EnumValue_description(_ context.Conte return fc, nil } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_fields(ctx, field) if err != nil { return graphql.Null } @@ -4349,38 +11388,60 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil }) 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.(bool) + res := resTmp.([]introspection.Field) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", 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___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_interfaces(ctx, field) if err != nil { return graphql.Null } @@ -4393,7 +11454,7 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil + return obj.Interfaces(), nil }) if err != nil { ec.Error(ctx, err) @@ -4402,26 +11463,50 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]introspection.Type) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "__Type", Field: field, IsMethod: true, 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") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_name(ctx, field) +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) if err != nil { return graphql.Null } @@ -4434,38 +11519,59 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.PossibleTypes(), nil }) 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.(string) + res := resTmp.([]introspection.Type) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, 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") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_description(ctx, field) +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_enumValues(ctx, field) if err != nil { return graphql.Null } @@ -4478,7 +11584,7 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Description(), nil + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil }) if err != nil { ec.Error(ctx, err) @@ -4487,26 +11593,47 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]introspection.EnumValue) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "__Type", Field: field, IsMethod: true, 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") + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", 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___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_args(ctx, field) +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_inputFields(ctx, field) if err != nil { return graphql.Null } @@ -4519,28 +11646,25 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Args, nil + return obj.InputFields(), nil }) 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.([]introspection.InputValue) fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { @@ -4560,22 +11684,11 @@ func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field return nil, fmt.Errorf("no field named %q was found under type __InputValue", 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___Field_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_type(ctx, field) +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_ofType(ctx, field) if err != nil { return graphql.Null } @@ -4588,28 +11701,25 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return obj.OfType(), nil }) 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.(*introspection.Type) fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { @@ -4642,8 +11752,8 @@ func (ec *executionContext) fieldContext___Field_type(_ context.Context, field g return fc, nil } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) +func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_isOneOf(ctx, field) if err != nil { return graphql.Null } @@ -4656,26 +11766,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil + return obj.IsOneOf(), nil }) 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.(bool) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalOBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "__Type", Field: field, IsMethod: true, IsResolver: false, @@ -4686,1504 +11793,1773 @@ func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, return fc, nil } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) - if err != nil { - return graphql.Null +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputApproveLeaveInput(ctx context.Context, obj any) (model.ApproveLeaveInput, error) { + var it model.ApproveLeaveInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"approvedBy"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "approvedBy": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("approvedBy")) + data, err := ec.unmarshalNID2string(ctx, v) + if err != nil { + return it, err + } + it.ApprovedBy = data } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), 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) + + return it, nil } -func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - 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") - }, +func (ec *executionContext) unmarshalInputCreateDepartmentInput(ctx context.Context, obj any) (model.CreateDepartmentInput, error) { + var it model.CreateDepartmentInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - return fc, nil + + fieldsInOrder := [...]string{"name", "description", "managerId"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "description": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Description = data + case "managerId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("managerId")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ManagerID = data + } + } + + return it, nil } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_name(ctx, field) - if err != nil { - return graphql.Null +func (ec *executionContext) unmarshalInputCreateEmployeeInput(ctx context.Context, obj any) (model.CreateEmployeeInput, error) { + var it model.CreateEmployeeInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"userId", "employeeCode", "department", "position", "hireDate", "salary", "status"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - 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") + switch k { + case "userId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) + data, err := ec.unmarshalNID2string(ctx, v) + if err != nil { + return it, err + } + it.UserID = data + case "employeeCode": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("employeeCode")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.EmployeeCode = data + case "department": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("department")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Department = data + case "position": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("position")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Position = data + case "hireDate": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hireDate")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.HireDate = data + case "salary": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("salary")) + data, err := ec.unmarshalNFloat2float64(ctx, v) + if err != nil { + return it, err + } + it.Salary = data + case "status": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Status = data } - return graphql.Null } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + + return it, nil } -func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - 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") - }, +func (ec *executionContext) unmarshalInputCreateLeaveInput(ctx context.Context, obj any) (model.CreateLeaveInput, error) { + var it model.CreateLeaveInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"employeeId", "leaveType", "startDate", "endDate", "reason"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "employeeId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("employeeId")) + data, err := ec.unmarshalNID2string(ctx, v) + if err != nil { + return it, err + } + it.EmployeeID = data + case "leaveType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("leaveType")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.LeaveType = data + case "startDate": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startDate")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.StartDate = data + case "endDate": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("endDate")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.EndDate = data + case "reason": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reason")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Reason = data + } } - return fc, nil + + return it, nil } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_description(ctx, field) - if err != nil { - return graphql.Null +func (ec *executionContext) unmarshalInputCreatePositionInput(ctx context.Context, obj any) (model.CreatePositionInput, error) { + var it model.CreatePositionInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"title", "description", "departmentId", "requirements", "minSalary", "maxSalary"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "title": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Title = data + case "description": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Description = data + case "departmentId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("departmentId")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.DepartmentID = data + case "requirements": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requirements")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Requirements = data + case "minSalary": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("minSalary")) + data, err := ec.unmarshalNFloat2float64(ctx, v) + if err != nil { + return it, err + } + it.MinSalary = data + case "maxSalary": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxSalary")) + data, err := ec.unmarshalNFloat2float64(ctx, v) + if err != nil { + return it, err + } + it.MaxSalary = data } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), 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___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - 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 + return it, nil } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_type(ctx, field) - if err != nil { - return graphql.Null +func (ec *executionContext) unmarshalInputCreateUserInput(ctx context.Context, obj any) (model.CreateUserInput, error) { + var it model.CreateUserInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"email", "name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - 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") + switch k { + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Email = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data } - return graphql.Null } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + + return it, nil } -func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) +func (ec *executionContext) unmarshalInputUpdateDepartmentInput(ctx context.Context, obj any) (model.UpdateDepartmentInput, error) { + var it model.UpdateDepartmentInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "description", "managerId"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + it.Name = data + case "description": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Description = data + case "managerId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("managerId")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ManagerID = data + } } - return fc, nil + + return it, nil } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) - if err != nil { - return graphql.Null +func (ec *executionContext) unmarshalInputUpdateEmployeeInput(ctx context.Context, obj any) (model.UpdateEmployeeInput, error) { + var it model.UpdateEmployeeInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"employeeCode", "department", "position", "hireDate", "salary", "status"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "employeeCode": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("employeeCode")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EmployeeCode = data + case "department": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("department")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Department = data + case "position": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("position")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Position = data + case "hireDate": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hireDate")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HireDate = data + case "salary": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("salary")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Salary = data + case "status": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Status = data } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.DefaultValue, 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___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - 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 + return it, nil } -func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_isDeprecated(ctx, field) - if err != nil { - return graphql.Null +func (ec *executionContext) unmarshalInputUpdateLeaveInput(ctx context.Context, obj any) (model.UpdateLeaveInput, error) { + var it model.UpdateLeaveInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"leaveType", "startDate", "endDate", "reason"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil - }) - 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") + switch k { + case "leaveType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("leaveType")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.LeaveType = data + case "startDate": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startDate")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StartDate = data + case "endDate": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("endDate")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EndDate = data + case "reason": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reason")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Reason = data } - return graphql.Null } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___InputValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return it, nil } -func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_deprecationReason(ctx, field) - if err != nil { - return graphql.Null +func (ec *executionContext) unmarshalInputUpdatePositionInput(ctx context.Context, obj any) (model.UpdatePositionInput, error) { + var it model.UpdatePositionInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"title", "description", "departmentId", "requirements", "minSalary", "maxSalary"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "title": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Title = data + case "description": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Description = data + case "departmentId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("departmentId")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.DepartmentID = data + case "requirements": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requirements")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Requirements = data + case "minSalary": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("minSalary")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.MinSalary = data + case "maxSalary": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxSalary")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.MaxSalary = data } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), 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___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - 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 + return it, nil } -func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_description(ctx, field) - if err != nil { - return graphql.Null +func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, obj any) (model.UpdateUserInput, error) { + var it model.UpdateUserInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"email", "name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Email = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), 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___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - 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 + return it, nil } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_types(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 +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var approveLeavePayloadImplementors = []string{"ApproveLeavePayload"} + +func (ec *executionContext) _ApproveLeavePayload(ctx context.Context, sel ast.SelectionSet, obj *model.ApproveLeavePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, approveLeavePayloadImplementors) + + 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("ApproveLeavePayload") + case "leave": + out.Values[i] = ec._ApproveLeavePayload_leave(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._ApproveLeavePayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Types(), nil - }) - 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") - } + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_queryType(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 +var cancelLeavePayloadImplementors = []string{"CancelLeavePayload"} + +func (ec *executionContext) _CancelLeavePayload(ctx context.Context, sel ast.SelectionSet, obj *model.CancelLeavePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, cancelLeavePayloadImplementors) + + 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("CancelLeavePayload") + case "leave": + out.Values[i] = ec._CancelLeavePayload_leave(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._CancelLeavePayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.QueryType(), nil - }) - 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") - } + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_mutationType(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 +var createDepartmentPayloadImplementors = []string{"CreateDepartmentPayload"} + +func (ec *executionContext) _CreateDepartmentPayload(ctx context.Context, sel ast.SelectionSet, obj *model.CreateDepartmentPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createDepartmentPayloadImplementors) + + 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("CreateDepartmentPayload") + case "department": + out.Values[i] = ec._CreateDepartmentPayload_department(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._CreateDepartmentPayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.MutationType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + + 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 } -func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) +var createEmployeePayloadImplementors = []string{"CreateEmployeePayload"} + +func (ec *executionContext) _CreateEmployeePayload(ctx context.Context, sel ast.SelectionSet, obj *model.CreateEmployeePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createEmployeePayloadImplementors) + + 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("CreateEmployeePayload") + case "employee": + out.Values[i] = ec._CreateEmployeePayload_employee(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + case "errors": + out.Values[i] = ec._CreateEmployeePayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null } - return fc, nil -} -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) - if err != nil { - 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, + }) } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + return out +} + +var createLeavePayloadImplementors = []string{"CreateLeavePayload"} + +func (ec *executionContext) _CreateLeavePayload(ctx context.Context, sel ast.SelectionSet, obj *model.CreateLeavePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createLeavePayloadImplementors) + + 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("CreateLeavePayload") + case "leave": + out.Values[i] = ec._CreateLeavePayload_leave(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._CreateLeavePayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.SubscriptionType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_directives(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 +var createPositionPayloadImplementors = []string{"CreatePositionPayload"} + +func (ec *executionContext) _CreatePositionPayload(ctx context.Context, sel ast.SelectionSet, obj *model.CreatePositionPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createPositionPayloadImplementors) + + 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("CreatePositionPayload") + case "position": + out.Values[i] = ec._CreatePositionPayload_position(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._CreatePositionPayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Directives(), nil - }) - 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") - } + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.([]introspection.Directive) - fc.Result = res - return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Directive_name(ctx, field) - case "description": - return ec.fieldContext___Directive_description(ctx, field) - case "isRepeatable": - return ec.fieldContext___Directive_isRepeatable(ctx, field) - case "locations": - return ec.fieldContext___Directive_locations(ctx, field) - case "args": - return ec.fieldContext___Directive_args(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_kind(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 +var createUserPayloadImplementors = []string{"CreateUserPayload"} + +func (ec *executionContext) _CreateUserPayload(ctx context.Context, sel ast.SelectionSet, obj *model.CreateUserPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createUserPayloadImplementors) + + 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("CreateUserPayload") + case "user": + out.Values[i] = ec._CreateUserPayload_user(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._CreateUserPayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Kind(), nil - }) - 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") - } + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.(string) - fc.Result = res - return ec.marshalN__TypeKind2string(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __TypeKind does not have child fields") - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_name(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 +var deleteDepartmentPayloadImplementors = []string{"DeleteDepartmentPayload"} + +func (ec *executionContext) _DeleteDepartmentPayload(ctx context.Context, sel ast.SelectionSet, obj *model.DeleteDepartmentPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deleteDepartmentPayloadImplementors) + + 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("DeleteDepartmentPayload") + case "success": + out.Values[i] = ec._DeleteDepartmentPayload_success(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._DeleteDepartmentPayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - 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") - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_description(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 +var deleteEmployeePayloadImplementors = []string{"DeleteEmployeePayload"} + +func (ec *executionContext) _DeleteEmployeePayload(ctx context.Context, sel ast.SelectionSet, obj *model.DeleteEmployeePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deleteEmployeePayloadImplementors) + + 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("DeleteEmployeePayload") + case "success": + out.Values[i] = ec._DeleteEmployeePayload_success(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._DeleteEmployeePayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - 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") - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_specifiedByURL(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 +var deleteLeavePayloadImplementors = []string{"DeleteLeavePayload"} + +func (ec *executionContext) _DeleteLeavePayload(ctx context.Context, sel ast.SelectionSet, obj *model.DeleteLeavePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deleteLeavePayloadImplementors) + + 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("DeleteLeavePayload") + case "success": + out.Values[i] = ec._DeleteLeavePayload_success(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._DeleteLeavePayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.SpecifiedByURL(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - 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") - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_fields(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 +var deletePositionPayloadImplementors = []string{"DeletePositionPayload"} + +func (ec *executionContext) _DeletePositionPayload(ctx context.Context, sel ast.SelectionSet, obj *model.DeletePositionPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deletePositionPayloadImplementors) + + 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("DeletePositionPayload") + case "success": + out.Values[i] = ec._DeletePositionPayload_success(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._DeletePositionPayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.([]introspection.Field) - fc.Result = res - return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) + + 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 } -func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Field_name(ctx, field) - case "description": - return ec.fieldContext___Field_description(ctx, field) - case "args": - return ec.fieldContext___Field_args(ctx, field) - case "type": - return ec.fieldContext___Field_type(ctx, field) - case "isDeprecated": - return ec.fieldContext___Field_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___Field_deprecationReason(ctx, field) +var deleteUserPayloadImplementors = []string{"DeleteUserPayload"} + +func (ec *executionContext) _DeleteUserPayload(ctx context.Context, sel ast.SelectionSet, obj *model.DeleteUserPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deleteUserPayloadImplementors) + + 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("DeleteUserPayload") + case "success": + out.Values[i] = ec._DeleteUserPayload_success(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) + case "errors": + out.Values[i] = ec._DeleteUserPayload_errors(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err } - return fc, nil -} - -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_interfaces(ctx, field) - if err != nil { + out.Dispatch(ctx) + if out.Invalids > 0 { 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 + + 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 departmentImplementors = []string{"Department"} + +func (ec *executionContext) _Department(ctx context.Context, sel ast.SelectionSet, obj *model.Department) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, departmentImplementors) + + 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("Department") + case "id": + out.Values[i] = ec._Department_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._Department_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec._Department_description(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "managerId": + out.Values[i] = ec._Department_managerId(ctx, field, obj) + case "createdAt": + out.Values[i] = ec._Department_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedAt": + out.Values[i] = ec._Department_updatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Interfaces(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_possibleTypes(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 +var departmentConnectionImplementors = []string{"DepartmentConnection"} + +func (ec *executionContext) _DepartmentConnection(ctx context.Context, sel ast.SelectionSet, obj *model.DepartmentConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, departmentConnectionImplementors) + + 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("DepartmentConnection") + case "edges": + out.Values[i] = ec._DepartmentConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._DepartmentConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.PossibleTypes(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_enumValues(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) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null +var departmentEdgeImplementors = []string{"DepartmentEdge"} + +func (ec *executionContext) _DepartmentEdge(ctx context.Context, sel ast.SelectionSet, obj *model.DepartmentEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, departmentEdgeImplementors) + + 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("DepartmentEdge") + case "node": + out.Values[i] = ec._DepartmentEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "cursor": + out.Values[i] = ec._DepartmentEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.([]introspection.EnumValue) - fc.Result = res - return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) + + 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 } -func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___EnumValue_name(ctx, field) - case "description": - return ec.fieldContext___EnumValue_description(ctx, field) - case "isDeprecated": - return ec.fieldContext___EnumValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___EnumValue_deprecationReason(ctx, field) +var employeeImplementors = []string{"Employee"} + +func (ec *executionContext) _Employee(ctx context.Context, sel ast.SelectionSet, obj *model.Employee) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, employeeImplementors) + + 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("Employee") + case "id": + out.Values[i] = ec._Employee_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) + case "user": + out.Values[i] = ec._Employee_user(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "employeeCode": + out.Values[i] = ec._Employee_employeeCode(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "department": + out.Values[i] = ec._Employee_department(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "position": + out.Values[i] = ec._Employee_position(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "hireDate": + out.Values[i] = ec._Employee_hireDate(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "salary": + out.Values[i] = ec._Employee_salary(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "status": + out.Values[i] = ec._Employee_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._Employee_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedAt": + out.Values[i] = ec._Employee_updatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err } - return fc, nil -} - -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_inputFields(ctx, field) - if err != nil { + out.Dispatch(ctx) + if out.Invalids > 0 { 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 + + 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 employeeConnectionImplementors = []string{"EmployeeConnection"} + +func (ec *executionContext) _EmployeeConnection(ctx context.Context, sel ast.SelectionSet, obj *model.EmployeeConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, employeeConnectionImplementors) + + 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("EmployeeConnection") + case "edges": + out.Values[i] = ec._EmployeeConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._EmployeeConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.InputFields(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - case "isDeprecated": - return ec.fieldContext___InputValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___InputValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_ofType(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 +var employeeEdgeImplementors = []string{"EmployeeEdge"} + +func (ec *executionContext) _EmployeeEdge(ctx context.Context, sel ast.SelectionSet, obj *model.EmployeeEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, employeeEdgeImplementors) + + 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("EmployeeEdge") + case "node": + out.Values[i] = ec._EmployeeEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "cursor": + out.Values[i] = ec._EmployeeEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.OfType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + 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 fc, nil + + return out } -func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_isOneOf(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 +var errorImplementors = []string{"Error"} + +func (ec *executionContext) _Error(ctx context.Context, sel ast.SelectionSet, obj *model.Error) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, errorImplementors) + + 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("Error") + case "message": + out.Values[i] = ec._Error_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "field": + out.Values[i] = ec._Error_field(ctx, field, obj) + case "code": + out.Values[i] = ec._Error_code(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsOneOf(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null } - if resTmp == nil { + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - res := resTmp.(bool) - fc.Result = res - return ec.marshalOBoolean2bool(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, + 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 fc, nil -} -// endregion **************************** field.gotpl ***************************** + return out +} -// region **************************** input.gotpl ***************************** +var leaveImplementors = []string{"Leave"} -func (ec *executionContext) unmarshalInputCreateEmployeeInput(ctx context.Context, obj any) (model.CreateEmployeeInput, error) { - var it model.CreateEmployeeInput - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } +func (ec *executionContext) _Leave(ctx context.Context, sel ast.SelectionSet, obj *model.Leave) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, leaveImplementors) - fieldsInOrder := [...]string{"userId", "employeeCode", "department", "position", "hireDate", "salary", "status"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "userId": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) - data, err := ec.unmarshalNID2string(ctx, v) - if err != nil { - return it, err + 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("Leave") + case "id": + out.Values[i] = ec._Leave_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.UserID = data - case "employeeCode": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("employeeCode")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + case "employeeId": + out.Values[i] = ec._Leave_employeeId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.EmployeeCode = data - case "department": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("department")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + case "leaveType": + out.Values[i] = ec._Leave_leaveType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Department = data - case "position": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("position")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + case "startDate": + out.Values[i] = ec._Leave_startDate(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Position = data - case "hireDate": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hireDate")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + case "endDate": + out.Values[i] = ec._Leave_endDate(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.HireDate = data - case "salary": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("salary")) - data, err := ec.unmarshalNFloat2float64(ctx, v) - if err != nil { - return it, err + case "reason": + out.Values[i] = ec._Leave_reason(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Salary = data case "status": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + out.Values[i] = ec._Leave_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Status = data + case "approvedBy": + out.Values[i] = ec._Leave_approvedBy(ctx, field, obj) + case "approvedAt": + out.Values[i] = ec._Leave_approvedAt(ctx, field, obj) + case "createdAt": + out.Values[i] = ec._Leave_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedAt": + out.Values[i] = ec._Leave_updatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + 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 leaveConnectionImplementors = []string{"LeaveConnection"} + +func (ec *executionContext) _LeaveConnection(ctx context.Context, sel ast.SelectionSet, obj *model.LeaveConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, leaveConnectionImplementors) + + 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("LeaveConnection") + case "edges": + out.Values[i] = ec._LeaveConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._LeaveConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + 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 it, nil + return out } -func (ec *executionContext) unmarshalInputCreateUserInput(ctx context.Context, obj any) (model.CreateUserInput, error) { - var it model.CreateUserInput - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } +var leaveEdgeImplementors = []string{"LeaveEdge"} - fieldsInOrder := [...]string{"email", "name"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "email": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err +func (ec *executionContext) _LeaveEdge(ctx context.Context, sel ast.SelectionSet, obj *model.LeaveEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, leaveEdgeImplementors) + + 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("LeaveEdge") + case "node": + out.Values[i] = ec._LeaveEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Email = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + case "cursor": + out.Values[i] = ec._LeaveEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Name = data + default: + panic("unknown field " + strconv.Quote(field.Name)) } } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } - return it, nil -} + atomic.AddInt32(&ec.deferred, int32(len(deferred))) -func (ec *executionContext) unmarshalInputUpdateEmployeeInput(ctx context.Context, obj any) (model.UpdateEmployeeInput, error) { - var it model.UpdateEmployeeInput - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) } - fieldsInOrder := [...]string{"employeeCode", "department", "position", "hireDate", "salary", "status"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "employeeCode": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("employeeCode")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + return out +} + +var mutationImplementors = []string{"Mutation"} + +func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Mutation", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Mutation") + case "createUser": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createUser(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.EmployeeCode = data - case "department": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("department")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "updateUser": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateUser(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Department = data - case "position": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("position")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "deleteUser": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteUser(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Position = data - case "hireDate": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hireDate")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "createEmployee": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createEmployee(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.HireDate = data - case "salary": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("salary")) - data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) - if err != nil { - return it, err + case "updateEmployee": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateEmployee(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Salary = data - case "status": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "deleteEmployee": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteEmployee(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Status = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, obj any) (model.UpdateUserInput, error) { - var it model.UpdateUserInput - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"email", "name"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "email": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "createDepartment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createDepartment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Email = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "updateDepartment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateDepartment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Name = data + case "deleteDepartment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteDepartment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createPosition": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createPosition(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatePosition": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updatePosition(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deletePosition": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deletePosition(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createLeave": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createLeave(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateLeave": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateLeave(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "approveLeave": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_approveLeave(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "rejectLeave": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_rejectLeave(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "cancelLeave": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_cancelLeave(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteLeave": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteLeave(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } - return it, nil -} - -// endregion **************************** input.gotpl ***************************** - -// region ************************** interface.gotpl *************************** + atomic.AddInt32(&ec.deferred, int32(len(deferred))) -// endregion ************************** interface.gotpl *************************** + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } -// region **************************** object.gotpl **************************** + return out +} -var createEmployeePayloadImplementors = []string{"CreateEmployeePayload"} +var pageInfoImplementors = []string{"PageInfo"} -func (ec *executionContext) _CreateEmployeePayload(ctx context.Context, sel ast.SelectionSet, obj *model.CreateEmployeePayload) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, createEmployeePayloadImplementors) +func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *model.PageInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, pageInfoImplementors) 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("CreateEmployeePayload") - case "employee": - out.Values[i] = ec._CreateEmployeePayload_employee(ctx, field, obj) + out.Values[i] = graphql.MarshalString("PageInfo") + case "hasNextPage": + out.Values[i] = ec._PageInfo_hasNextPage(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "errors": - out.Values[i] = ec._CreateEmployeePayload_errors(ctx, field, obj) + case "hasPreviousPage": + out.Values[i] = ec._PageInfo_hasPreviousPage(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "startCursor": + out.Values[i] = ec._PageInfo_startCursor(ctx, field, obj) + case "endCursor": + out.Values[i] = ec._PageInfo_endCursor(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -6207,24 +13583,59 @@ func (ec *executionContext) _CreateEmployeePayload(ctx context.Context, sel ast. return out } -var createUserPayloadImplementors = []string{"CreateUserPayload"} +var positionImplementors = []string{"Position"} -func (ec *executionContext) _CreateUserPayload(ctx context.Context, sel ast.SelectionSet, obj *model.CreateUserPayload) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, createUserPayloadImplementors) +func (ec *executionContext) _Position(ctx context.Context, sel ast.SelectionSet, obj *model.Position) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, positionImplementors) 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("CreateUserPayload") - case "user": - out.Values[i] = ec._CreateUserPayload_user(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Position") + case "id": + out.Values[i] = ec._Position_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "title": + out.Values[i] = ec._Position_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec._Position_description(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "departmentId": + out.Values[i] = ec._Position_departmentId(ctx, field, obj) + case "requirements": + out.Values[i] = ec._Position_requirements(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "minSalary": + out.Values[i] = ec._Position_minSalary(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "maxSalary": + out.Values[i] = ec._Position_maxSalary(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._Position_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedAt": + out.Values[i] = ec._Position_updatedAt(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "errors": - out.Values[i] = ec._CreateUserPayload_errors(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -6248,24 +13659,27 @@ func (ec *executionContext) _CreateUserPayload(ctx context.Context, sel ast.Sele return out } -var deleteEmployeePayloadImplementors = []string{"DeleteEmployeePayload"} +var positionConnectionImplementors = []string{"PositionConnection"} -func (ec *executionContext) _DeleteEmployeePayload(ctx context.Context, sel ast.SelectionSet, obj *model.DeleteEmployeePayload) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, deleteEmployeePayloadImplementors) +func (ec *executionContext) _PositionConnection(ctx context.Context, sel ast.SelectionSet, obj *model.PositionConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, positionConnectionImplementors) 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("DeleteEmployeePayload") - case "success": - out.Values[i] = ec._DeleteEmployeePayload_success(ctx, field, obj) + out.Values[i] = graphql.MarshalString("PositionConnection") + case "edges": + out.Values[i] = ec._PositionConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._PositionConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "errors": - out.Values[i] = ec._DeleteEmployeePayload_errors(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -6289,24 +13703,27 @@ func (ec *executionContext) _DeleteEmployeePayload(ctx context.Context, sel ast. return out } -var deleteUserPayloadImplementors = []string{"DeleteUserPayload"} +var positionEdgeImplementors = []string{"PositionEdge"} -func (ec *executionContext) _DeleteUserPayload(ctx context.Context, sel ast.SelectionSet, obj *model.DeleteUserPayload) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, deleteUserPayloadImplementors) +func (ec *executionContext) _PositionEdge(ctx context.Context, sel ast.SelectionSet, obj *model.PositionEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, positionEdgeImplementors) 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("DeleteUserPayload") - case "success": - out.Values[i] = ec._DeleteUserPayload_success(ctx, field, obj) + out.Values[i] = graphql.MarshalString("PositionEdge") + case "node": + out.Values[i] = ec._PositionEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "cursor": + out.Values[i] = ec._PositionEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "errors": - out.Values[i] = ec._DeleteUserPayload_errors(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -6330,155 +13747,370 @@ func (ec *executionContext) _DeleteUserPayload(ctx context.Context, sel ast.Sele return out } -var employeeImplementors = []string{"Employee"} +var queryImplementors = []string{"Query"} + +func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "user": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_user(ctx, field) + 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) }) + case "users": + 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_users(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) }) + case "employee": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_employee(ctx, field) + 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) }) + case "employees": + 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_employees(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) }) + case "employeesByDepartment": + 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_employeesByDepartment(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) }) + case "employeesByStatus": + 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_employeesByStatus(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) }) + case "department": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_department(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } -func (ec *executionContext) _Employee(ctx context.Context, sel ast.SelectionSet, obj *model.Employee) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, employeeImplementors) + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "departments": + field := field - 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("Employee") - case "id": - out.Values[i] = ec._Employee_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + 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_departments(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - case "user": - out.Values[i] = ec._Employee_user(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - case "employeeCode": - out.Values[i] = ec._Employee_employeeCode(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "departmentsByManager": + 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_departmentsByManager(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - case "department": - out.Values[i] = ec._Employee_department(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + 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) }) case "position": - out.Values[i] = ec._Employee_position(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "hireDate": - out.Values[i] = ec._Employee_hireDate(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "salary": - out.Values[i] = ec._Employee_salary(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "status": - out.Values[i] = ec._Employee_status(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_position(ctx, field) + return res } - case "createdAt": - out.Values[i] = ec._Employee_createdAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - case "updatedAt": - out.Values[i] = ec._Employee_updatedAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "positions": + 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_positions(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - 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))) + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "positionsByDepartment": + field := field - return out -} + 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_positionsByDepartment(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } -var employeeConnectionImplementors = []string{"EmployeeConnection"} + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } -func (ec *executionContext) _EmployeeConnection(ctx context.Context, sel ast.SelectionSet, obj *model.EmployeeConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, employeeConnectionImplementors) + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "leave": + field := field - 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("EmployeeConnection") - case "edges": - out.Values[i] = ec._EmployeeConnection_edges(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_leave(ctx, field) + return res } - case "pageInfo": - out.Values[i] = ec._EmployeeConnection_pageInfo(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - 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))) + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "leaves": + field := field - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } + 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_leaves(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } - return out -} + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } -var employeeEdgeImplementors = []string{"EmployeeEdge"} + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "leavesByEmployee": + field := field -func (ec *executionContext) _EmployeeEdge(ctx context.Context, sel ast.SelectionSet, obj *model.EmployeeEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, employeeEdgeImplementors) + 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_leavesByEmployee(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } - 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("EmployeeEdge") - case "node": - out.Values[i] = ec._EmployeeEdge_node(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - case "cursor": - out.Values[i] = ec._EmployeeEdge_cursor(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "leavesByStatus": + 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_leavesByStatus(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) }) + case "__type": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___type(ctx, field) + }) + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___schema(ctx, field) + }) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -6502,26 +14134,24 @@ func (ec *executionContext) _EmployeeEdge(ctx context.Context, sel ast.Selection return out } -var errorImplementors = []string{"Error"} +var rejectLeavePayloadImplementors = []string{"RejectLeavePayload"} -func (ec *executionContext) _Error(ctx context.Context, sel ast.SelectionSet, obj *model.Error) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, errorImplementors) +func (ec *executionContext) _RejectLeavePayload(ctx context.Context, sel ast.SelectionSet, obj *model.RejectLeavePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, rejectLeavePayloadImplementors) 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("Error") - case "message": - out.Values[i] = ec._Error_message(ctx, field, obj) + out.Values[i] = graphql.MarshalString("RejectLeavePayload") + case "leave": + out.Values[i] = ec._RejectLeavePayload_leave(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "field": - out.Values[i] = ec._Error_field(ctx, field, obj) - case "code": - out.Values[i] = ec._Error_code(ctx, field, obj) + case "errors": + out.Values[i] = ec._RejectLeavePayload_errors(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -6545,67 +14175,24 @@ func (ec *executionContext) _Error(ctx context.Context, sel ast.SelectionSet, ob return out } -var mutationImplementors = []string{"Mutation"} +var updateDepartmentPayloadImplementors = []string{"UpdateDepartmentPayload"} -func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) - ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ - Object: "Mutation", - }) +func (ec *executionContext) _UpdateDepartmentPayload(ctx context.Context, sel ast.SelectionSet, obj *model.UpdateDepartmentPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updateDepartmentPayloadImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { - innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ - Object: field.Name, - Field: field, - }) - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Mutation") - case "createUser": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_createUser(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "updateUser": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_updateUser(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deleteUser": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_deleteUser(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "createEmployee": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_createEmployee(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "updateEmployee": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_updateEmployee(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deleteEmployee": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_deleteEmployee(ctx, field) - }) + out.Values[i] = graphql.MarshalString("UpdateDepartmentPayload") + case "department": + out.Values[i] = ec._UpdateDepartmentPayload_department(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } + case "errors": + out.Values[i] = ec._UpdateDepartmentPayload_errors(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -6629,207 +14216,65 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return out } -var pageInfoImplementors = []string{"PageInfo"} +var updateEmployeePayloadImplementors = []string{"UpdateEmployeePayload"} -func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *model.PageInfo) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, pageInfoImplementors) +func (ec *executionContext) _UpdateEmployeePayload(ctx context.Context, sel ast.SelectionSet, obj *model.UpdateEmployeePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updateEmployeePayloadImplementors) 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("PageInfo") - case "hasNextPage": - out.Values[i] = ec._PageInfo_hasNextPage(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "hasPreviousPage": - out.Values[i] = ec._PageInfo_hasPreviousPage(ctx, field, obj) + out.Values[i] = graphql.MarshalString("UpdateEmployeePayload") + case "employee": + out.Values[i] = ec._UpdateEmployeePayload_employee(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "startCursor": - out.Values[i] = ec._PageInfo_startCursor(ctx, field, obj) - case "endCursor": - out.Values[i] = ec._PageInfo_endCursor(ctx, field, obj) + case "errors": + out.Values[i] = ec._UpdateEmployeePayload_errors(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 queryImplementors = []string{"Query"} - -func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ - Object: "Query", - }) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ - Object: field.Name, - Field: field, - }) - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Query") - case "user": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_user(ctx, field) - 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) }) - case "users": - 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_users(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) }) - case "employee": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_employee(ctx, field) - 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) }) - case "employees": - 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_employees(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) }) - case "employeesByDepartment": - 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_employeesByDepartment(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } + return graphql.Null + } - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } + atomic.AddInt32(&ec.deferred, int32(len(deferred))) - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "employeesByStatus": - field := field + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } - 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_employeesByStatus(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } + return out +} - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } +var updateLeavePayloadImplementors = []string{"UpdateLeavePayload"} - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "__type": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Query___type(ctx, field) - }) - case "__schema": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Query___schema(ctx, field) - }) +func (ec *executionContext) _UpdateLeavePayload(ctx context.Context, sel ast.SelectionSet, obj *model.UpdateLeavePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updateLeavePayloadImplementors) + + 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("UpdateLeavePayload") + case "leave": + out.Values[i] = ec._UpdateLeavePayload_leave(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._UpdateLeavePayload_errors(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -6853,24 +14298,24 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return out } -var updateEmployeePayloadImplementors = []string{"UpdateEmployeePayload"} +var updatePositionPayloadImplementors = []string{"UpdatePositionPayload"} -func (ec *executionContext) _UpdateEmployeePayload(ctx context.Context, sel ast.SelectionSet, obj *model.UpdateEmployeePayload) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, updateEmployeePayloadImplementors) +func (ec *executionContext) _UpdatePositionPayload(ctx context.Context, sel ast.SelectionSet, obj *model.UpdatePositionPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updatePositionPayloadImplementors) 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("UpdateEmployeePayload") - case "employee": - out.Values[i] = ec._UpdateEmployeePayload_employee(ctx, field, obj) + out.Values[i] = graphql.MarshalString("UpdatePositionPayload") + case "position": + out.Values[i] = ec._UpdatePositionPayload_position(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "errors": - out.Values[i] = ec._UpdateEmployeePayload_errors(ctx, field, obj) + out.Values[i] = ec._UpdatePositionPayload_errors(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -7010,11 +14455,217 @@ func (ec *executionContext) _UserConnection(ctx context.Context, sel ast.Selecti if out.Values[i] == graphql.Null { out.Invalids++ } - case "pageInfo": - out.Values[i] = ec._UserConnection_pageInfo(ctx, field, obj) + case "pageInfo": + out.Values[i] = ec._UserConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + 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 userEdgeImplementors = []string{"UserEdge"} + +func (ec *executionContext) _UserEdge(ctx context.Context, sel ast.SelectionSet, obj *model.UserEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userEdgeImplementors) + + 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("UserEdge") + case "node": + out.Values[i] = ec._UserEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "cursor": + out.Values[i] = ec._UserEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + 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 __DirectiveImplementors = []string{"__Directive"} + +func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + 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("__Directive") + case "name": + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "locations": + out.Values[i] = ec.___Directive_locations(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + out.Values[i] = ec.___Directive_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + 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 __EnumValueImplementors = []string{"__EnumValue"} + +func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + 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("__EnumValue") + case "name": + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___EnumValue_deprecationReason(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 __FieldImplementors = []string{"__Field"} + +func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + 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("__Field") + case "name": + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Field_description(ctx, field, obj) + case "args": + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } + case "deprecationReason": + out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -7038,27 +14689,38 @@ func (ec *executionContext) _UserConnection(ctx context.Context, sel ast.Selecti return out } -var userEdgeImplementors = []string{"UserEdge"} +var __InputValueImplementors = []string{"__InputValue"} -func (ec *executionContext) _UserEdge(ctx context.Context, sel ast.SelectionSet, obj *model.UserEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, userEdgeImplementors) +func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) 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("UserEdge") - case "node": - out.Values[i] = ec._UserEdge_node(ctx, field, obj) + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ec.___InputValue_name(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "cursor": - out.Values[i] = ec._UserEdge_cursor(ctx, field, obj) + case "description": + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + case "type": + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___InputValue_isDeprecated(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } + case "deprecationReason": + out.Values[i] = ec.___InputValue_deprecationReason(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -7082,36 +14744,35 @@ func (ec *executionContext) _UserEdge(ctx context.Context, sel ast.SelectionSet, return out } -var __DirectiveImplementors = []string{"__Directive"} +var __SchemaImplementors = []string{"__Schema"} -func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) +func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) 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("__Directive") - case "name": - out.Values[i] = ec.___Directive_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } + out.Values[i] = graphql.MarshalString("__Schema") case "description": - out.Values[i] = ec.___Directive_description(ctx, field, obj) - case "isRepeatable": - out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + out.Values[i] = ec.___Schema_description(ctx, field, obj) + case "types": + out.Values[i] = ec.___Schema_types(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "locations": - out.Values[i] = ec.___Directive_locations(ctx, field, obj) + case "queryType": + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "args": - out.Values[i] = ec.___Directive_args(ctx, field, obj) + case "mutationType": + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + case "subscriptionType": + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + case "directives": + out.Values[i] = ec.___Schema_directives(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -7138,31 +14799,42 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS return out } -var __EnumValueImplementors = []string{"__EnumValue"} +var __TypeImplementors = []string{"__Type"} -func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) +func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) 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("__EnumValue") - case "name": - out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ec.___Type_kind(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } + case "name": + out.Values[i] = ec.___Type_name(ctx, field, obj) case "description": - out.Values[i] = ec.___EnumValue_description(ctx, field, obj) - case "isDeprecated": - out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deprecationReason": - out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) + out.Values[i] = ec.___Type_description(ctx, field, obj) + case "specifiedByURL": + out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + case "fields": + out.Values[i] = ec.___Type_fields(ctx, field, obj) + case "interfaces": + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + case "possibleTypes": + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + case "enumValues": + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + case "inputFields": + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + case "ofType": + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + case "isOneOf": + out.Values[i] = ec.___Type_isOneOf(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -7186,344 +14858,535 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS return out } -var __FieldImplementors = []string{"__Field"} +// endregion **************************** object.gotpl **************************** -func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) +// region ***************************** type.gotpl ***************************** - 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("__Field") - case "name": - out.Values[i] = ec.___Field_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "description": - out.Values[i] = ec.___Field_description(ctx, field, obj) - case "args": - out.Values[i] = ec.___Field_args(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "type": - out.Values[i] = ec.___Field_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "isDeprecated": - out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deprecationReason": - out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) +func (ec *executionContext) unmarshalNApproveLeaveInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐApproveLeaveInput(ctx context.Context, v any) (model.ApproveLeaveInput, error) { + res, err := ec.unmarshalInputApproveLeaveInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApproveLeavePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐApproveLeavePayload(ctx context.Context, sel ast.SelectionSet, v model.ApproveLeavePayload) graphql.Marshaler { + return ec._ApproveLeavePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNApproveLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐApproveLeavePayload(ctx context.Context, sel ast.SelectionSet, v *model.ApproveLeavePayload) 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._ApproveLeavePayload(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v any) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + _ = sel + res := graphql.MarshalBoolean(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNCancelLeavePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCancelLeavePayload(ctx context.Context, sel ast.SelectionSet, v model.CancelLeavePayload) graphql.Marshaler { + return ec._CancelLeavePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCancelLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCancelLeavePayload(ctx context.Context, sel ast.SelectionSet, v *model.CancelLeavePayload) 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._CancelLeavePayload(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNCreateDepartmentInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateDepartmentInput(ctx context.Context, v any) (model.CreateDepartmentInput, error) { + res, err := ec.unmarshalInputCreateDepartmentInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCreateDepartmentPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateDepartmentPayload(ctx context.Context, sel ast.SelectionSet, v model.CreateDepartmentPayload) graphql.Marshaler { + return ec._CreateDepartmentPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCreateDepartmentPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateDepartmentPayload(ctx context.Context, sel ast.SelectionSet, v *model.CreateDepartmentPayload) 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._CreateDepartmentPayload(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNCreateEmployeeInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeeInput(ctx context.Context, v any) (model.CreateEmployeeInput, error) { + res, err := ec.unmarshalInputCreateEmployeeInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCreateEmployeePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeePayload(ctx context.Context, sel ast.SelectionSet, v model.CreateEmployeePayload) graphql.Marshaler { + return ec._CreateEmployeePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCreateEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeePayload(ctx context.Context, sel ast.SelectionSet, v *model.CreateEmployeePayload) 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._CreateEmployeePayload(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNCreateLeaveInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateLeaveInput(ctx context.Context, v any) (model.CreateLeaveInput, error) { + res, err := ec.unmarshalInputCreateLeaveInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCreateLeavePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateLeavePayload(ctx context.Context, sel ast.SelectionSet, v model.CreateLeavePayload) graphql.Marshaler { + return ec._CreateLeavePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCreateLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateLeavePayload(ctx context.Context, sel ast.SelectionSet, v *model.CreateLeavePayload) 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._CreateLeavePayload(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNCreatePositionInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreatePositionInput(ctx context.Context, v any) (model.CreatePositionInput, error) { + res, err := ec.unmarshalInputCreatePositionInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCreatePositionPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreatePositionPayload(ctx context.Context, sel ast.SelectionSet, v model.CreatePositionPayload) graphql.Marshaler { + return ec._CreatePositionPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCreatePositionPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreatePositionPayload(ctx context.Context, sel ast.SelectionSet, v *model.CreatePositionPayload) 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._CreatePositionPayload(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNCreateUserInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserInput(ctx context.Context, v any) (model.CreateUserInput, error) { + res, err := ec.unmarshalInputCreateUserInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCreateUserPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserPayload(ctx context.Context, sel ast.SelectionSet, v model.CreateUserPayload) graphql.Marshaler { + return ec._CreateUserPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCreateUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserPayload(ctx context.Context, sel ast.SelectionSet, v *model.CreateUserPayload) 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") } - } - out.Dispatch(ctx) - if out.Invalids > 0 { return graphql.Null } + return ec._CreateUserPayload(ctx, sel, v) +} - atomic.AddInt32(&ec.deferred, int32(len(deferred))) +func (ec *executionContext) marshalNDeleteDepartmentPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteDepartmentPayload(ctx context.Context, sel ast.SelectionSet, v model.DeleteDepartmentPayload) graphql.Marshaler { + return ec._DeleteDepartmentPayload(ctx, sel, &v) +} - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) +func (ec *executionContext) marshalNDeleteDepartmentPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteDepartmentPayload(ctx context.Context, sel ast.SelectionSet, v *model.DeleteDepartmentPayload) 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._DeleteDepartmentPayload(ctx, sel, v) +} - return out +func (ec *executionContext) marshalNDeleteEmployeePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteEmployeePayload(ctx context.Context, sel ast.SelectionSet, v model.DeleteEmployeePayload) graphql.Marshaler { + return ec._DeleteEmployeePayload(ctx, sel, &v) } -var __InputValueImplementors = []string{"__InputValue"} +func (ec *executionContext) marshalNDeleteEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteEmployeePayload(ctx context.Context, sel ast.SelectionSet, v *model.DeleteEmployeePayload) 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._DeleteEmployeePayload(ctx, sel, v) +} -func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) +func (ec *executionContext) marshalNDeleteLeavePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteLeavePayload(ctx context.Context, sel ast.SelectionSet, v model.DeleteLeavePayload) graphql.Marshaler { + return ec._DeleteLeavePayload(ctx, sel, &v) +} - 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("__InputValue") - case "name": - out.Values[i] = ec.___InputValue_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "description": - out.Values[i] = ec.___InputValue_description(ctx, field, obj) - case "type": - out.Values[i] = ec.___InputValue_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "defaultValue": - out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) - case "isDeprecated": - out.Values[i] = ec.___InputValue_isDeprecated(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deprecationReason": - out.Values[i] = ec.___InputValue_deprecationReason(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) +func (ec *executionContext) marshalNDeleteLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteLeavePayload(ctx context.Context, sel ast.SelectionSet, v *model.DeleteLeavePayload) 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 } - out.Dispatch(ctx) - if out.Invalids > 0 { + return ec._DeleteLeavePayload(ctx, sel, v) +} + +func (ec *executionContext) marshalNDeletePositionPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeletePositionPayload(ctx context.Context, sel ast.SelectionSet, v model.DeletePositionPayload) graphql.Marshaler { + return ec._DeletePositionPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDeletePositionPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeletePositionPayload(ctx context.Context, sel ast.SelectionSet, v *model.DeletePositionPayload) 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._DeletePositionPayload(ctx, sel, v) +} - atomic.AddInt32(&ec.deferred, int32(len(deferred))) +func (ec *executionContext) marshalNDeleteUserPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteUserPayload(ctx context.Context, sel ast.SelectionSet, v model.DeleteUserPayload) graphql.Marshaler { + return ec._DeleteUserPayload(ctx, sel, &v) +} - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) +func (ec *executionContext) marshalNDeleteUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteUserPayload(ctx context.Context, sel ast.SelectionSet, v *model.DeleteUserPayload) 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._DeleteUserPayload(ctx, sel, v) +} - return out +func (ec *executionContext) marshalNDepartment2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartment(ctx context.Context, sel ast.SelectionSet, v *model.Department) 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._Department(ctx, sel, v) } -var __SchemaImplementors = []string{"__Schema"} +func (ec *executionContext) marshalNDepartmentConnection2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartmentConnection(ctx context.Context, sel ast.SelectionSet, v model.DepartmentConnection) graphql.Marshaler { + return ec._DepartmentConnection(ctx, sel, &v) +} -func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) +func (ec *executionContext) marshalNDepartmentConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartmentConnection(ctx context.Context, sel ast.SelectionSet, v *model.DepartmentConnection) 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._DepartmentConnection(ctx, sel, v) +} - 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("__Schema") - case "description": - out.Values[i] = ec.___Schema_description(ctx, field, obj) - case "types": - out.Values[i] = ec.___Schema_types(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "queryType": - out.Values[i] = ec.___Schema_queryType(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "mutationType": - out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) - case "subscriptionType": - out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) - case "directives": - out.Values[i] = ec.___Schema_directives(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ +func (ec *executionContext) marshalNDepartmentEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartmentEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DepartmentEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() } - default: - panic("unknown field " + strconv.Quote(field.Name)) + ret[i] = ec.marshalNDepartmentEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartmentEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) } + } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } } - atomic.AddInt32(&ec.deferred, int32(len(deferred))) + return ret +} - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) +func (ec *executionContext) marshalNDepartmentEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartmentEdge(ctx context.Context, sel ast.SelectionSet, v *model.DepartmentEdge) 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 out + return ec._DepartmentEdge(ctx, sel, v) } -var __TypeImplementors = []string{"__Type"} +func (ec *executionContext) marshalNEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx context.Context, sel ast.SelectionSet, v *model.Employee) 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._Employee(ctx, sel, v) +} -func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) +func (ec *executionContext) marshalNEmployeeConnection2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx context.Context, sel ast.SelectionSet, v model.EmployeeConnection) graphql.Marshaler { + return ec._EmployeeConnection(ctx, sel, &v) +} - 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("__Type") - case "kind": - out.Values[i] = ec.___Type_kind(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec.___Type_name(ctx, field, obj) - case "description": - out.Values[i] = ec.___Type_description(ctx, field, obj) - case "specifiedByURL": - out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) - case "fields": - out.Values[i] = ec.___Type_fields(ctx, field, obj) - case "interfaces": - out.Values[i] = ec.___Type_interfaces(ctx, field, obj) - case "possibleTypes": - out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) - case "enumValues": - out.Values[i] = ec.___Type_enumValues(ctx, field, obj) - case "inputFields": - out.Values[i] = ec.___Type_inputFields(ctx, field, obj) - case "ofType": - out.Values[i] = ec.___Type_ofType(ctx, field, obj) - case "isOneOf": - out.Values[i] = ec.___Type_isOneOf(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) +func (ec *executionContext) marshalNEmployeeConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx context.Context, sel ast.SelectionSet, v *model.EmployeeConnection) 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") } - } - out.Dispatch(ctx) - if out.Invalids > 0 { return graphql.Null } + return ec._EmployeeConnection(ctx, sel, v) +} - atomic.AddInt32(&ec.deferred, int32(len(deferred))) +func (ec *executionContext) marshalNEmployeeEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.EmployeeEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNEmployeeEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) } + wg.Wait() - return out + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret } -// endregion **************************** object.gotpl **************************** +func (ec *executionContext) marshalNEmployeeEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeEdge(ctx context.Context, sel ast.SelectionSet, v *model.EmployeeEdge) 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._EmployeeEdge(ctx, sel, v) +} -// region ***************************** type.gotpl ***************************** +func (ec *executionContext) marshalNError2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐError(ctx context.Context, sel ast.SelectionSet, v *model.Error) 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._Error(ctx, sel, v) +} -func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v any) (bool, error) { - res, err := graphql.UnmarshalBoolean(v) +func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v any) (float64, error) { + res, err := graphql.UnmarshalFloatContext(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { +func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { _ = sel - res := graphql.MarshalBoolean(v) + res := graphql.MarshalFloatContext(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } } - return res + return graphql.WrapContextMarshaler(ctx, res) } -func (ec *executionContext) unmarshalNCreateEmployeeInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeeInput(ctx context.Context, v any) (model.CreateEmployeeInput, error) { - res, err := ec.unmarshalInputCreateEmployeeInput(ctx, v) +func (ec *executionContext) unmarshalNID2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalID(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNCreateEmployeePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeePayload(ctx context.Context, sel ast.SelectionSet, v model.CreateEmployeePayload) graphql.Marshaler { - return ec._CreateEmployeePayload(ctx, sel, &v) +func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + _ = sel + res := graphql.MarshalID(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res } -func (ec *executionContext) marshalNCreateEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateEmployeePayload(ctx context.Context, sel ast.SelectionSet, v *model.CreateEmployeePayload) graphql.Marshaler { +func (ec *executionContext) marshalNLeave2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeave(ctx context.Context, sel ast.SelectionSet, v *model.Leave) 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._CreateEmployeePayload(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNCreateUserInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserInput(ctx context.Context, v any) (model.CreateUserInput, error) { - res, err := ec.unmarshalInputCreateUserInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) + return ec._Leave(ctx, sel, v) } -func (ec *executionContext) marshalNCreateUserPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserPayload(ctx context.Context, sel ast.SelectionSet, v model.CreateUserPayload) graphql.Marshaler { - return ec._CreateUserPayload(ctx, sel, &v) +func (ec *executionContext) marshalNLeaveConnection2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeaveConnection(ctx context.Context, sel ast.SelectionSet, v model.LeaveConnection) graphql.Marshaler { + return ec._LeaveConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNCreateUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐCreateUserPayload(ctx context.Context, sel ast.SelectionSet, v *model.CreateUserPayload) graphql.Marshaler { +func (ec *executionContext) marshalNLeaveConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeaveConnection(ctx context.Context, sel ast.SelectionSet, v *model.LeaveConnection) 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._CreateUserPayload(ctx, sel, v) + return ec._LeaveConnection(ctx, sel, v) } -func (ec *executionContext) marshalNDeleteEmployeePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteEmployeePayload(ctx context.Context, sel ast.SelectionSet, v model.DeleteEmployeePayload) graphql.Marshaler { - return ec._DeleteEmployeePayload(ctx, sel, &v) +func (ec *executionContext) marshalNLeaveEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeaveEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.LeaveEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNLeaveEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeaveEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret } -func (ec *executionContext) marshalNDeleteEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteEmployeePayload(ctx context.Context, sel ast.SelectionSet, v *model.DeleteEmployeePayload) graphql.Marshaler { +func (ec *executionContext) marshalNLeaveEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeaveEdge(ctx context.Context, sel ast.SelectionSet, v *model.LeaveEdge) 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._DeleteEmployeePayload(ctx, sel, v) -} - -func (ec *executionContext) marshalNDeleteUserPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteUserPayload(ctx context.Context, sel ast.SelectionSet, v model.DeleteUserPayload) graphql.Marshaler { - return ec._DeleteUserPayload(ctx, sel, &v) + return ec._LeaveEdge(ctx, sel, v) } -func (ec *executionContext) marshalNDeleteUserPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDeleteUserPayload(ctx context.Context, sel ast.SelectionSet, v *model.DeleteUserPayload) graphql.Marshaler { +func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *model.PageInfo) 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._DeleteUserPayload(ctx, sel, v) + return ec._PageInfo(ctx, sel, v) } -func (ec *executionContext) marshalNEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx context.Context, sel ast.SelectionSet, v *model.Employee) graphql.Marshaler { +func (ec *executionContext) marshalNPosition2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPosition(ctx context.Context, sel ast.SelectionSet, v *model.Position) 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._Employee(ctx, sel, v) + return ec._Position(ctx, sel, v) } -func (ec *executionContext) marshalNEmployeeConnection2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx context.Context, sel ast.SelectionSet, v model.EmployeeConnection) graphql.Marshaler { - return ec._EmployeeConnection(ctx, sel, &v) +func (ec *executionContext) marshalNPositionConnection2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPositionConnection(ctx context.Context, sel ast.SelectionSet, v model.PositionConnection) graphql.Marshaler { + return ec._PositionConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNEmployeeConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeConnection(ctx context.Context, sel ast.SelectionSet, v *model.EmployeeConnection) graphql.Marshaler { +func (ec *executionContext) marshalNPositionConnection2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPositionConnection(ctx context.Context, sel ast.SelectionSet, v *model.PositionConnection) 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._EmployeeConnection(ctx, sel, v) + return ec._PositionConnection(ctx, sel, v) } -func (ec *executionContext) marshalNEmployeeEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.EmployeeEdge) graphql.Marshaler { +func (ec *executionContext) marshalNPositionEdge2ᚕᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPositionEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.PositionEdge) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -7547,7 +15410,7 @@ func (ec *executionContext) marshalNEmployeeEdge2ᚕᚖgithubᚗcomᚋcaptainᚑ if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNEmployeeEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeEdge(ctx, sel, v[i]) + ret[i] = ec.marshalNPositionEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPositionEdge(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7567,101 +15430,120 @@ func (ec *executionContext) marshalNEmployeeEdge2ᚕᚖgithubᚗcomᚋcaptainᚑ return ret } -func (ec *executionContext) marshalNEmployeeEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployeeEdge(ctx context.Context, sel ast.SelectionSet, v *model.EmployeeEdge) graphql.Marshaler { +func (ec *executionContext) marshalNPositionEdge2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPositionEdge(ctx context.Context, sel ast.SelectionSet, v *model.PositionEdge) 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._EmployeeEdge(ctx, sel, v) + return ec._PositionEdge(ctx, sel, v) } -func (ec *executionContext) marshalNError2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐError(ctx context.Context, sel ast.SelectionSet, v *model.Error) graphql.Marshaler { +func (ec *executionContext) marshalNRejectLeavePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐRejectLeavePayload(ctx context.Context, sel ast.SelectionSet, v model.RejectLeavePayload) graphql.Marshaler { + return ec._RejectLeavePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNRejectLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐRejectLeavePayload(ctx context.Context, sel ast.SelectionSet, v *model.RejectLeavePayload) 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._Error(ctx, sel, v) + return ec._RejectLeavePayload(ctx, sel, v) } -func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v any) (float64, error) { - res, err := graphql.UnmarshalFloatContext(ctx, v) +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { +func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { _ = sel - res := graphql.MarshalFloatContext(v) + res := graphql.MarshalString(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } } - return graphql.WrapContextMarshaler(ctx, res) + return res } -func (ec *executionContext) unmarshalNID2string(ctx context.Context, v any) (string, error) { - res, err := graphql.UnmarshalID(v) +func (ec *executionContext) unmarshalNUpdateDepartmentInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateDepartmentInput(ctx context.Context, v any) (model.UpdateDepartmentInput, error) { + res, err := ec.unmarshalInputUpdateDepartmentInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - _ = sel - res := graphql.MarshalID(v) - if res == graphql.Null { +func (ec *executionContext) marshalNUpdateDepartmentPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateDepartmentPayload(ctx context.Context, sel ast.SelectionSet, v model.UpdateDepartmentPayload) graphql.Marshaler { + return ec._UpdateDepartmentPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUpdateDepartmentPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateDepartmentPayload(ctx context.Context, sel ast.SelectionSet, v *model.UpdateDepartmentPayload) 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 res + return ec._UpdateDepartmentPayload(ctx, sel, v) } -func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *model.PageInfo) graphql.Marshaler { +func (ec *executionContext) unmarshalNUpdateEmployeeInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeeInput(ctx context.Context, v any) (model.UpdateEmployeeInput, error) { + res, err := ec.unmarshalInputUpdateEmployeeInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNUpdateEmployeePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeePayload(ctx context.Context, sel ast.SelectionSet, v model.UpdateEmployeePayload) graphql.Marshaler { + return ec._UpdateEmployeePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUpdateEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeePayload(ctx context.Context, sel ast.SelectionSet, v *model.UpdateEmployeePayload) 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._PageInfo(ctx, sel, v) + return ec._UpdateEmployeePayload(ctx, sel, v) } -func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) { - res, err := graphql.UnmarshalString(v) +func (ec *executionContext) unmarshalNUpdateLeaveInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateLeaveInput(ctx context.Context, v any) (model.UpdateLeaveInput, error) { + res, err := ec.unmarshalInputUpdateLeaveInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - _ = sel - res := graphql.MarshalString(v) - if res == graphql.Null { +func (ec *executionContext) marshalNUpdateLeavePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateLeavePayload(ctx context.Context, sel ast.SelectionSet, v model.UpdateLeavePayload) graphql.Marshaler { + return ec._UpdateLeavePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUpdateLeavePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateLeavePayload(ctx context.Context, sel ast.SelectionSet, v *model.UpdateLeavePayload) 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 res + return ec._UpdateLeavePayload(ctx, sel, v) } -func (ec *executionContext) unmarshalNUpdateEmployeeInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeeInput(ctx context.Context, v any) (model.UpdateEmployeeInput, error) { - res, err := ec.unmarshalInputUpdateEmployeeInput(ctx, v) +func (ec *executionContext) unmarshalNUpdatePositionInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdatePositionInput(ctx context.Context, v any) (model.UpdatePositionInput, error) { + res, err := ec.unmarshalInputUpdatePositionInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNUpdateEmployeePayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeePayload(ctx context.Context, sel ast.SelectionSet, v model.UpdateEmployeePayload) graphql.Marshaler { - return ec._UpdateEmployeePayload(ctx, sel, &v) +func (ec *executionContext) marshalNUpdatePositionPayload2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdatePositionPayload(ctx context.Context, sel ast.SelectionSet, v model.UpdatePositionPayload) graphql.Marshaler { + return ec._UpdatePositionPayload(ctx, sel, &v) } -func (ec *executionContext) marshalNUpdateEmployeePayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateEmployeePayload(ctx context.Context, sel ast.SelectionSet, v *model.UpdateEmployeePayload) graphql.Marshaler { +func (ec *executionContext) marshalNUpdatePositionPayload2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdatePositionPayload(ctx context.Context, sel ast.SelectionSet, v *model.UpdatePositionPayload) 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._UpdateEmployeePayload(ctx, sel, v) + return ec._UpdatePositionPayload(ctx, sel, v) } func (ec *executionContext) unmarshalNUpdateUserInput2githubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐUpdateUserInput(ctx context.Context, v any) (model.UpdateUserInput, error) { @@ -8044,6 +15926,13 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast return res } +func (ec *executionContext) marshalODepartment2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐDepartment(ctx context.Context, sel ast.SelectionSet, v *model.Department) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Department(ctx, sel, v) +} + func (ec *executionContext) marshalOEmployee2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐEmployee(ctx context.Context, sel ast.SelectionSet, v *model.Employee) graphql.Marshaler { if v == nil { return graphql.Null @@ -8115,6 +16004,24 @@ func (ec *executionContext) marshalOFloat2ᚖfloat64(ctx context.Context, sel as return graphql.WrapContextMarshaler(ctx, res) } +func (ec *executionContext) unmarshalOID2ᚖstring(ctx context.Context, v any) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalID(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOID2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalID(*v) + return res +} + func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v any) (*int, error) { if v == nil { return nil, nil @@ -8133,6 +16040,20 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele return res } +func (ec *executionContext) marshalOLeave2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐLeave(ctx context.Context, sel ast.SelectionSet, v *model.Leave) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Leave(ctx, sel, v) +} + +func (ec *executionContext) marshalOPosition2ᚖgithubᚗcomᚋcaptainᚑcorgiᚋgoᚑgraphqlᚑexampleᚋinternalᚋinterfacesᚋgraphqlᚋmodelᚐPosition(ctx context.Context, sel ast.SelectionSet, v *model.Position) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Position(ctx, sel, v) +} + func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v any) (*string, error) { if v == nil { return nil, nil diff --git a/internal/interfaces/graphql/model/models_gen.go b/internal/interfaces/graphql/model/models_gen.go index b0a4b9f..e9f509e 100644 --- a/internal/interfaces/graphql/model/models_gen.go +++ b/internal/interfaces/graphql/model/models_gen.go @@ -2,6 +2,31 @@ package model +type ApproveLeaveInput struct { + ApprovedBy string `json:"approvedBy"` +} + +type ApproveLeavePayload struct { + Leave *Leave `json:"leave"` + Errors []*Error `json:"errors,omitempty"` +} + +type CancelLeavePayload struct { + Leave *Leave `json:"leave"` + Errors []*Error `json:"errors,omitempty"` +} + +type CreateDepartmentInput struct { + Name string `json:"name"` + Description string `json:"description"` + ManagerID *string `json:"managerId,omitempty"` +} + +type CreateDepartmentPayload struct { + Department *Department `json:"department"` + Errors []*Error `json:"errors,omitempty"` +} + type CreateEmployeeInput struct { UserID string `json:"userId"` EmployeeCode string `json:"employeeCode"` @@ -17,6 +42,33 @@ type CreateEmployeePayload struct { Errors []*Error `json:"errors,omitempty"` } +type CreateLeaveInput struct { + EmployeeID string `json:"employeeId"` + LeaveType string `json:"leaveType"` + StartDate string `json:"startDate"` + EndDate string `json:"endDate"` + Reason string `json:"reason"` +} + +type CreateLeavePayload struct { + Leave *Leave `json:"leave"` + Errors []*Error `json:"errors,omitempty"` +} + +type CreatePositionInput struct { + Title string `json:"title"` + Description string `json:"description"` + DepartmentID *string `json:"departmentId,omitempty"` + Requirements string `json:"requirements"` + MinSalary float64 `json:"minSalary"` + MaxSalary float64 `json:"maxSalary"` +} + +type CreatePositionPayload struct { + Position *Position `json:"position"` + Errors []*Error `json:"errors,omitempty"` +} + type CreateUserInput struct { Email string `json:"email"` Name string `json:"name"` @@ -27,16 +79,50 @@ type CreateUserPayload struct { Errors []*Error `json:"errors,omitempty"` } +type DeleteDepartmentPayload struct { + Success bool `json:"success"` + Errors []*Error `json:"errors,omitempty"` +} + type DeleteEmployeePayload struct { Success bool `json:"success"` Errors []*Error `json:"errors,omitempty"` } +type DeleteLeavePayload struct { + Success bool `json:"success"` + Errors []*Error `json:"errors,omitempty"` +} + +type DeletePositionPayload struct { + Success bool `json:"success"` + Errors []*Error `json:"errors,omitempty"` +} + type DeleteUserPayload struct { Success bool `json:"success"` Errors []*Error `json:"errors,omitempty"` } +type Department struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + ManagerID *string `json:"managerId,omitempty"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` +} + +type DepartmentConnection struct { + Edges []*DepartmentEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type DepartmentEdge struct { + Node *Department `json:"node"` + Cursor string `json:"cursor"` +} + type Employee struct { ID string `json:"id"` User *User `json:"user"` @@ -66,6 +152,30 @@ type Error struct { Code *string `json:"code,omitempty"` } +type Leave struct { + ID string `json:"id"` + EmployeeID string `json:"employeeId"` + LeaveType string `json:"leaveType"` + StartDate string `json:"startDate"` + EndDate string `json:"endDate"` + Reason string `json:"reason"` + Status string `json:"status"` + ApprovedBy *string `json:"approvedBy,omitempty"` + ApprovedAt *string `json:"approvedAt,omitempty"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` +} + +type LeaveConnection struct { + Edges []*LeaveEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type LeaveEdge struct { + Node *Leave `json:"node"` + Cursor string `json:"cursor"` +} + type Mutation struct { } @@ -76,9 +186,47 @@ type PageInfo struct { EndCursor *string `json:"endCursor,omitempty"` } +type Position struct { + ID string `json:"id"` + Title string `json:"title"` + Description string `json:"description"` + DepartmentID *string `json:"departmentId,omitempty"` + Requirements string `json:"requirements"` + MinSalary float64 `json:"minSalary"` + MaxSalary float64 `json:"maxSalary"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` +} + +type PositionConnection struct { + Edges []*PositionEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type PositionEdge struct { + Node *Position `json:"node"` + Cursor string `json:"cursor"` +} + type Query struct { } +type RejectLeavePayload struct { + Leave *Leave `json:"leave"` + Errors []*Error `json:"errors,omitempty"` +} + +type UpdateDepartmentInput struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + ManagerID *string `json:"managerId,omitempty"` +} + +type UpdateDepartmentPayload struct { + Department *Department `json:"department"` + Errors []*Error `json:"errors,omitempty"` +} + type UpdateEmployeeInput struct { EmployeeCode *string `json:"employeeCode,omitempty"` Department *string `json:"department,omitempty"` @@ -93,6 +241,32 @@ type UpdateEmployeePayload struct { Errors []*Error `json:"errors,omitempty"` } +type UpdateLeaveInput struct { + LeaveType *string `json:"leaveType,omitempty"` + StartDate *string `json:"startDate,omitempty"` + EndDate *string `json:"endDate,omitempty"` + Reason *string `json:"reason,omitempty"` +} + +type UpdateLeavePayload struct { + Leave *Leave `json:"leave"` + Errors []*Error `json:"errors,omitempty"` +} + +type UpdatePositionInput struct { + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + DepartmentID *string `json:"departmentId,omitempty"` + Requirements *string `json:"requirements,omitempty"` + MinSalary *float64 `json:"minSalary,omitempty"` + MaxSalary *float64 `json:"maxSalary,omitempty"` +} + +type UpdatePositionPayload struct { + Position *Position `json:"position"` + Errors []*Error `json:"errors,omitempty"` +} + type UpdateUserInput struct { Email *string `json:"email,omitempty"` Name *string `json:"name,omitempty"` diff --git a/internal/interfaces/graphql/resolver/employee.resolvers.go b/internal/interfaces/graphql/resolver/employee.resolvers.go deleted file mode 100644 index d43f2e7..0000000 --- a/internal/interfaces/graphql/resolver/employee.resolvers.go +++ /dev/null @@ -1,418 +0,0 @@ -package resolver - -import ( - "context" - "time" - - "github.com/captain-corgi/go-graphql-example/internal/application/employee" - "github.com/captain-corgi/go-graphql-example/internal/interfaces/graphql/model" -) - -// Employee is the resolver for the employee field. -func (r *queryResolver) Employee(ctx context.Context, id string) (*model.Employee, error) { - // Log operation start - r.logOperation(ctx, "Employee", map[string]interface{}{ - "id": id, - }) - - // Validate and sanitize input - sanitizedID := sanitizeString(id) - if err := r.validateInput(ctx, "Employee", func() error { - return validateEmployeeID(sanitizedID) - }); err != nil { - return nil, err - } - - // Call application service - req := employee.GetEmployeeRequest{ID: sanitizedID} - resp, err := r.employeeService.GetEmployee(ctx, req) - if err != nil { - return nil, r.handleGraphQLError(ctx, err, "Employee") - } - - // No application-level errors for GetEmployeeResponse - - // Map result to GraphQL model - result := mapEmployeeDTOToGraphQL(resp.Employee) - r.logOperationSuccess(ctx, "Employee", result) - - return result, nil -} - -// Employees is the resolver for the employees field. -func (r *queryResolver) Employees(ctx context.Context, first *int, after *string) (*model.EmployeeConnection, error) { - // Log operation start - r.logOperation(ctx, "Employees", map[string]interface{}{ - "first": first, - "after": after, - }) - - // Validate pagination parameters - if err := r.validateInput(ctx, "Employees", func() error { - return validatePaginationParams(first, after) - }); err != nil { - return nil, err - } - - // Sanitize after parameter - var sanitizedAfter string - if after != nil { - sanitizedAfter = sanitizeString(*after) - } - - // Set default first value - firstValue := 10 // Default page size - if first != nil { - firstValue = *first - } - - // Call application service - req := employee.ListEmployeesRequest{ - Limit: firstValue, - Cursor: sanitizedAfter, - } - resp, err := r.employeeService.ListEmployees(ctx, req) - if err != nil { - return nil, r.handleGraphQLError(ctx, err, "Employees") - } - - // No application-level errors for ListEmployeesResponse - - // Map result to GraphQL model - result := mapEmployeeConnectionDTOToGraphQL(resp.Employees, resp.NextCursor) - r.logOperationSuccess(ctx, "Employees", result) - - return result, nil -} - -// EmployeesByDepartment is the resolver for the employeesByDepartment field. -func (r *queryResolver) EmployeesByDepartment(ctx context.Context, department string, first *int, after *string) (*model.EmployeeConnection, error) { - // Log operation start - r.logOperation(ctx, "EmployeesByDepartment", map[string]interface{}{ - "department": department, - "first": first, - "after": after, - }) - - // Validate pagination parameters - if err := r.validateInput(ctx, "EmployeesByDepartment", func() error { - return validatePaginationParams(first, after) - }); err != nil { - return nil, err - } - - // Sanitize inputs - sanitizedDepartment := sanitizeString(department) - var sanitizedAfter string - if after != nil { - sanitizedAfter = sanitizeString(*after) - } - - // Set default first value - firstValue := 10 // Default page size - if first != nil { - firstValue = *first - } - - // Call application service - req := employee.ListEmployeesByDepartmentRequest{ - Department: sanitizedDepartment, - Limit: firstValue, - Cursor: sanitizedAfter, - } - resp, err := r.employeeService.ListEmployeesByDepartment(ctx, req) - if err != nil { - return nil, r.handleGraphQLError(ctx, err, "EmployeesByDepartment") - } - - // No application-level errors for ListEmployeesByDepartmentResponse - - // Map result to GraphQL model - result := mapEmployeeConnectionDTOToGraphQL(resp.Employees, resp.NextCursor) - r.logOperationSuccess(ctx, "EmployeesByDepartment", result) - - return result, nil -} - -// EmployeesByStatus is the resolver for the employeesByStatus field. -func (r *queryResolver) EmployeesByStatus(ctx context.Context, status string, first *int, after *string) (*model.EmployeeConnection, error) { - // Log operation start - r.logOperation(ctx, "EmployeesByStatus", map[string]interface{}{ - "status": status, - "first": first, - "after": after, - }) - - // Validate pagination parameters - if err := r.validateInput(ctx, "EmployeesByStatus", func() error { - return validatePaginationParams(first, after) - }); err != nil { - return nil, err - } - - // Sanitize inputs - sanitizedStatus := sanitizeString(status) - var sanitizedAfter string - if after != nil { - sanitizedAfter = sanitizeString(*after) - } - - // Set default first value - firstValue := 10 // Default page size - if first != nil { - firstValue = *first - } - - // Call application service - req := employee.ListEmployeesByStatusRequest{ - Status: sanitizedStatus, - Limit: firstValue, - Cursor: sanitizedAfter, - } - resp, err := r.employeeService.ListEmployeesByStatus(ctx, req) - if err != nil { - return nil, r.handleGraphQLError(ctx, err, "EmployeesByStatus") - } - - // No application-level errors for ListEmployeesByStatusResponse - - // Map result to GraphQL model - result := mapEmployeeConnectionDTOToGraphQL(resp.Employees, resp.NextCursor) - r.logOperationSuccess(ctx, "EmployeesByStatus", result) - - return result, nil -} - -// CreateEmployee is the resolver for the createEmployee field. -func (r *mutationResolver) CreateEmployee(ctx context.Context, input model.CreateEmployeeInput) (*model.CreateEmployeePayload, error) { - // Log operation start - r.logOperation(ctx, "CreateEmployee", map[string]interface{}{ - "userId": input.UserID, - "employeeCode": input.EmployeeCode, - "department": input.Department, - "position": input.Position, - "hireDate": input.HireDate, - "salary": input.Salary, - "status": input.Status, - }) - - // Validate and sanitize input - sanitizedInput := model.CreateEmployeeInput{ - UserID: sanitizeString(input.UserID), - EmployeeCode: sanitizeString(input.EmployeeCode), - Department: sanitizeString(input.Department), - Position: sanitizeString(input.Position), - HireDate: sanitizeString(input.HireDate), - Salary: input.Salary, - Status: sanitizeString(input.Status), - } - - if err := r.validateInput(ctx, "CreateEmployee", func() error { - return validateCreateEmployeeInput(sanitizedInput) - }); err != nil { - return &model.CreateEmployeePayload{ - Errors: []*model.Error{mapEmployeeErrorDTOToGraphQL(employee.ErrorDTO{ - Message: err.Error(), - Code: "VALIDATION_ERROR", - })}, - }, nil - } - - // Parse hire date - hireDate, err := time.Parse("2006-01-02", sanitizedInput.HireDate) - if err != nil { - return &model.CreateEmployeePayload{ - Errors: []*model.Error{mapEmployeeErrorDTOToGraphQL(employee.ErrorDTO{ - Message: "Invalid hire date format. Use YYYY-MM-DD", - Code: "INVALID_HIRE_DATE", - Field: "hireDate", - })}, - }, nil - } - - // Call application service - req := employee.CreateEmployeeRequest{ - UserID: sanitizedInput.UserID, - EmployeeCode: sanitizedInput.EmployeeCode, - Department: sanitizedInput.Department, - Position: sanitizedInput.Position, - HireDate: hireDate, - Salary: sanitizedInput.Salary, - Status: sanitizedInput.Status, - } - resp, err := r.employeeService.CreateEmployee(ctx, req) - if err != nil { - return &model.CreateEmployeePayload{ - Errors: []*model.Error{mapEmployeeErrorDTOToGraphQL(employee.ErrorDTO{ - Message: "Failed to create employee", - Code: "INTERNAL_ERROR", - })}, - }, nil - } - - // Handle application-level errors - if len(resp.Errors) > 0 { - return &model.CreateEmployeePayload{ - Errors: mapEmployeeErrorDTOsToGraphQL(resp.Errors), - }, nil - } - - // Map successful result - result := &model.CreateEmployeePayload{ - Employee: mapEmployeeDTOToGraphQL(resp.Employee), - } - - r.logOperationSuccess(ctx, "CreateEmployee", result) - return result, nil -} - -// UpdateEmployee is the resolver for the updateEmployee field. -func (r *mutationResolver) UpdateEmployee(ctx context.Context, id string, input model.UpdateEmployeeInput) (*model.UpdateEmployeePayload, error) { - // Log operation start - r.logOperation(ctx, "UpdateEmployee", map[string]interface{}{ - "id": id, - "employeeCode": input.EmployeeCode, - "department": input.Department, - "position": input.Position, - "hireDate": input.HireDate, - "salary": input.Salary, - "status": input.Status, - }) - - // Validate and sanitize input - sanitizedID := sanitizeString(id) - sanitizedInput := model.UpdateEmployeeInput{ - EmployeeCode: sanitizeStringPointer(input.EmployeeCode), - Department: sanitizeStringPointer(input.Department), - Position: sanitizeStringPointer(input.Position), - HireDate: sanitizeStringPointer(input.HireDate), - Salary: input.Salary, - Status: sanitizeStringPointer(input.Status), - } - - // Validate employee ID - if err := r.validateInput(ctx, "UpdateEmployee", func() error { - return validateEmployeeID(sanitizedID) - }); err != nil { - return &model.UpdateEmployeePayload{ - Errors: []*model.Error{mapEmployeeErrorDTOToGraphQL(employee.ErrorDTO{ - Message: err.Error(), - Code: "VALIDATION_ERROR", - })}, - }, nil - } - - // Validate update input - if err := r.validateInput(ctx, "UpdateEmployee", func() error { - return validateUpdateEmployeeInput(sanitizedInput) - }); err != nil { - return &model.UpdateEmployeePayload{ - Errors: []*model.Error{mapEmployeeErrorDTOToGraphQL(employee.ErrorDTO{ - Message: err.Error(), - Code: "VALIDATION_ERROR", - })}, - }, nil - } - - // Parse hire date if provided - var hireDate *time.Time - if sanitizedInput.HireDate != nil { - parsedDate, err := time.Parse("2006-01-02", *sanitizedInput.HireDate) - if err != nil { - return &model.UpdateEmployeePayload{ - Errors: []*model.Error{mapEmployeeErrorDTOToGraphQL(employee.ErrorDTO{ - Message: "Invalid hire date format. Use YYYY-MM-DD", - Code: "INVALID_HIRE_DATE", - Field: "hireDate", - })}, - }, nil - } - hireDate = &parsedDate - } - - // Call application service - req := employee.UpdateEmployeeRequest{ - ID: sanitizedID, - EmployeeCode: sanitizedInput.EmployeeCode, - Department: sanitizedInput.Department, - Position: sanitizedInput.Position, - HireDate: hireDate, - Salary: sanitizedInput.Salary, - Status: sanitizedInput.Status, - } - resp, err := r.employeeService.UpdateEmployee(ctx, req) - if err != nil { - return &model.UpdateEmployeePayload{ - Errors: []*model.Error{mapEmployeeErrorDTOToGraphQL(employee.ErrorDTO{ - Message: "Failed to update employee", - Code: "INTERNAL_ERROR", - })}, - }, nil - } - - // Handle application-level errors - if len(resp.Errors) > 0 { - return &model.UpdateEmployeePayload{ - Errors: mapEmployeeErrorDTOsToGraphQL(resp.Errors), - }, nil - } - - // Map successful result - result := &model.UpdateEmployeePayload{ - Employee: mapEmployeeDTOToGraphQL(resp.Employee), - } - - r.logOperationSuccess(ctx, "UpdateEmployee", result) - return result, nil -} - -// DeleteEmployee is the resolver for the deleteEmployee field. -func (r *mutationResolver) DeleteEmployee(ctx context.Context, id string) (*model.DeleteEmployeePayload, error) { - // Log operation start - r.logOperation(ctx, "DeleteEmployee", map[string]interface{}{ - "id": id, - }) - - // Validate and sanitize input - sanitizedID := sanitizeString(id) - if err := r.validateInput(ctx, "DeleteEmployee", func() error { - return validateEmployeeID(sanitizedID) - }); err != nil { - return &model.DeleteEmployeePayload{ - Success: false, - Errors: []*model.Error{mapEmployeeErrorDTOToGraphQL(employee.ErrorDTO{ - Message: err.Error(), - Code: "VALIDATION_ERROR", - })}, - }, nil - } - - // Call application service - req := employee.DeleteEmployeeRequest{ID: sanitizedID} - resp, err := r.employeeService.DeleteEmployee(ctx, req) - if err != nil { - return &model.DeleteEmployeePayload{ - Success: false, - Errors: []*model.Error{mapEmployeeErrorDTOToGraphQL(employee.ErrorDTO{ - Message: "Failed to delete employee", - Code: "INTERNAL_ERROR", - })}, - }, nil - } - - // Handle application-level errors - if len(resp.Errors) > 0 { - return &model.DeleteEmployeePayload{ - Success: false, - Errors: mapEmployeeErrorDTOsToGraphQL(resp.Errors), - }, nil - } - - // Map successful result - result := &model.DeleteEmployeePayload{ - Success: resp.Success, - } - - r.logOperationSuccess(ctx, "DeleteEmployee", result) - return result, nil -} \ No newline at end of file diff --git a/internal/interfaces/graphql/resolver/mutation.resolvers.go b/internal/interfaces/graphql/resolver/mutation.resolvers.go index 35811b9..f574759 100644 --- a/internal/interfaces/graphql/resolver/mutation.resolvers.go +++ b/internal/interfaces/graphql/resolver/mutation.resolvers.go @@ -6,185 +6,104 @@ package resolver import ( "context" + "fmt" - "github.com/captain-corgi/go-graphql-example/internal/application/user" "github.com/captain-corgi/go-graphql-example/internal/interfaces/graphql/generated" "github.com/captain-corgi/go-graphql-example/internal/interfaces/graphql/model" ) // CreateUser is the resolver for the createUser field. func (r *mutationResolver) CreateUser(ctx context.Context, input model.CreateUserInput) (*model.CreateUserPayload, error) { - // Log operation start - r.logOperation(ctx, "CreateUser", map[string]interface{}{ - "email": input.Email, - "name": input.Name, - }) - - // Validate and sanitize input - sanitizedInput := model.CreateUserInput{ - Email: sanitizeString(input.Email), - Name: sanitizeString(input.Name), - } - - if err := r.validateInput(ctx, "CreateUser", func() error { - return validateCreateUserInput(sanitizedInput) - }); err != nil { - return &model.CreateUserPayload{ - Errors: []*model.Error{mapErrorDTOToGraphQL(user.ErrorDTO{ - Message: err.Error(), - Code: "VALIDATION_ERROR", - })}, - }, nil - } - - // Call application service - req := mapCreateUserInputToRequest(sanitizedInput) - resp, err := r.userService.CreateUser(ctx, req) - if err != nil { - return &model.CreateUserPayload{ - Errors: []*model.Error{mapErrorDTOToGraphQL(user.ErrorDTO{ - Message: "Failed to create user", - Code: "INTERNAL_ERROR", - })}, - }, nil - } - - // Handle application-level errors - if len(resp.Errors) > 0 { - return &model.CreateUserPayload{ - Errors: mapErrorDTOsToGraphQL(resp.Errors), - }, nil - } - - // Map successful result - result := &model.CreateUserPayload{ - User: mapUserDTOToGraphQL(resp.User), - } - - r.logOperationSuccess(ctx, "CreateUser", result) - return result, nil + panic(fmt.Errorf("not implemented: CreateUser - createUser")) } // UpdateUser is the resolver for the updateUser field. func (r *mutationResolver) UpdateUser(ctx context.Context, id string, input model.UpdateUserInput) (*model.UpdateUserPayload, error) { - // Log operation start - r.logOperation(ctx, "UpdateUser", map[string]interface{}{ - "id": id, - "email": input.Email, - "name": input.Name, - }) - - // Validate and sanitize input - sanitizedID := sanitizeString(id) - sanitizedInput := model.UpdateUserInput{ - Email: sanitizeStringPointer(input.Email), - Name: sanitizeStringPointer(input.Name), - } - - // Validate user ID - if err := r.validateInput(ctx, "UpdateUser", func() error { - return validateUserID(sanitizedID) - }); err != nil { - return &model.UpdateUserPayload{ - Errors: []*model.Error{mapErrorDTOToGraphQL(user.ErrorDTO{ - Message: err.Error(), - Code: "VALIDATION_ERROR", - })}, - }, nil - } - - // Validate update input - if err := r.validateInput(ctx, "UpdateUser", func() error { - return validateUpdateUserInput(sanitizedInput) - }); err != nil { - return &model.UpdateUserPayload{ - Errors: []*model.Error{mapErrorDTOToGraphQL(user.ErrorDTO{ - Message: err.Error(), - Code: "VALIDATION_ERROR", - })}, - }, nil - } - - // Call application service - req := mapUpdateUserInputToRequest(sanitizedID, sanitizedInput) - resp, err := r.userService.UpdateUser(ctx, req) - if err != nil { - return &model.UpdateUserPayload{ - Errors: []*model.Error{mapErrorDTOToGraphQL(user.ErrorDTO{ - Message: "Failed to update user", - Code: "INTERNAL_ERROR", - })}, - }, nil - } - - // Handle application-level errors - if len(resp.Errors) > 0 { - return &model.UpdateUserPayload{ - Errors: mapErrorDTOsToGraphQL(resp.Errors), - }, nil - } - - // Map successful result - result := &model.UpdateUserPayload{ - User: mapUserDTOToGraphQL(resp.User), - } - - r.logOperationSuccess(ctx, "UpdateUser", result) - return result, nil + panic(fmt.Errorf("not implemented: UpdateUser - updateUser")) } // DeleteUser is the resolver for the deleteUser field. func (r *mutationResolver) DeleteUser(ctx context.Context, id string) (*model.DeleteUserPayload, error) { - // Log operation start - r.logOperation(ctx, "DeleteUser", map[string]interface{}{ - "id": id, - }) - - // Validate and sanitize input - sanitizedID := sanitizeString(id) - if err := r.validateInput(ctx, "DeleteUser", func() error { - return validateUserID(sanitizedID) - }); err != nil { - return &model.DeleteUserPayload{ - Success: false, - Errors: []*model.Error{mapErrorDTOToGraphQL(user.ErrorDTO{ - Message: err.Error(), - Code: "VALIDATION_ERROR", - })}, - }, nil - } - - // Call application service - req := user.DeleteUserRequest{ID: sanitizedID} - resp, err := r.userService.DeleteUser(ctx, req) - if err != nil { - return &model.DeleteUserPayload{ - Success: false, - Errors: []*model.Error{mapErrorDTOToGraphQL(user.ErrorDTO{ - Message: "Failed to delete user", - Code: "INTERNAL_ERROR", - })}, - }, nil - } - - // Handle application-level errors - if len(resp.Errors) > 0 { - return &model.DeleteUserPayload{ - Success: false, - Errors: mapErrorDTOsToGraphQL(resp.Errors), - }, nil - } - - // Map successful result - result := &model.DeleteUserPayload{ - Success: resp.Success, - } - - r.logOperationSuccess(ctx, "DeleteUser", result) - return result, nil + panic(fmt.Errorf("not implemented: DeleteUser - deleteUser")) } +// CreateEmployee is the resolver for the createEmployee field. +func (r *mutationResolver) CreateEmployee(ctx context.Context, input model.CreateEmployeeInput) (*model.CreateEmployeePayload, error) { + panic(fmt.Errorf("not implemented: CreateEmployee - createEmployee")) +} + +// UpdateEmployee is the resolver for the updateEmployee field. +func (r *mutationResolver) UpdateEmployee(ctx context.Context, id string, input model.UpdateEmployeeInput) (*model.UpdateEmployeePayload, error) { + panic(fmt.Errorf("not implemented: UpdateEmployee - updateEmployee")) +} + +// DeleteEmployee is the resolver for the deleteEmployee field. +func (r *mutationResolver) DeleteEmployee(ctx context.Context, id string) (*model.DeleteEmployeePayload, error) { + panic(fmt.Errorf("not implemented: DeleteEmployee - deleteEmployee")) +} + +// CreateDepartment is the resolver for the createDepartment field. +func (r *mutationResolver) CreateDepartment(ctx context.Context, input model.CreateDepartmentInput) (*model.CreateDepartmentPayload, error) { + // TODO: Implement create department resolver + panic(fmt.Errorf("not implemented: CreateDepartment - createDepartment")) +} + +// UpdateDepartment is the resolver for the updateDepartment field. +func (r *mutationResolver) UpdateDepartment(ctx context.Context, id string, input model.UpdateDepartmentInput) (*model.UpdateDepartmentPayload, error) { + // TODO: Implement update department resolver + panic(fmt.Errorf("not implemented: UpdateDepartment - updateDepartment")) +} + +// DeleteDepartment is the resolver for the deleteDepartment field. +func (r *mutationResolver) DeleteDepartment(ctx context.Context, id string) (*model.DeleteDepartmentPayload, error) { + // TODO: Implement delete department resolver + panic(fmt.Errorf("not implemented: DeleteDepartment - deleteDepartment")) +} + +// CreatePosition is the resolver for the createPosition field. +func (r *mutationResolver) CreatePosition(ctx context.Context, input model.CreatePositionInput) (*model.CreatePositionPayload, error) { + panic(fmt.Errorf("not implemented: CreatePosition - createPosition")) +} + +// UpdatePosition is the resolver for the updatePosition field. +func (r *mutationResolver) UpdatePosition(ctx context.Context, id string, input model.UpdatePositionInput) (*model.UpdatePositionPayload, error) { + panic(fmt.Errorf("not implemented: UpdatePosition - updatePosition")) +} + +// DeletePosition is the resolver for the deletePosition field. +func (r *mutationResolver) DeletePosition(ctx context.Context, id string) (*model.DeletePositionPayload, error) { + panic(fmt.Errorf("not implemented: DeletePosition - deletePosition")) +} + +// CreateLeave is the resolver for the createLeave field. +func (r *mutationResolver) CreateLeave(ctx context.Context, input model.CreateLeaveInput) (*model.CreateLeavePayload, error) { + panic(fmt.Errorf("not implemented: CreateLeave - createLeave")) +} + +// UpdateLeave is the resolver for the updateLeave field. +func (r *mutationResolver) UpdateLeave(ctx context.Context, id string, input model.UpdateLeaveInput) (*model.UpdateLeavePayload, error) { + panic(fmt.Errorf("not implemented: UpdateLeave - updateLeave")) +} +// ApproveLeave is the resolver for the approveLeave field. +func (r *mutationResolver) ApproveLeave(ctx context.Context, id string, input model.ApproveLeaveInput) (*model.ApproveLeavePayload, error) { + panic(fmt.Errorf("not implemented: ApproveLeave - approveLeave")) +} + +// RejectLeave is the resolver for the rejectLeave field. +func (r *mutationResolver) RejectLeave(ctx context.Context, id string, input model.ApproveLeaveInput) (*model.RejectLeavePayload, error) { + panic(fmt.Errorf("not implemented: RejectLeave - rejectLeave")) +} + +// CancelLeave is the resolver for the cancelLeave field. +func (r *mutationResolver) CancelLeave(ctx context.Context, id string) (*model.CancelLeavePayload, error) { + panic(fmt.Errorf("not implemented: CancelLeave - cancelLeave")) +} + +// DeleteLeave is the resolver for the deleteLeave field. +func (r *mutationResolver) DeleteLeave(ctx context.Context, id string) (*model.DeleteLeavePayload, error) { + panic(fmt.Errorf("not implemented: DeleteLeave - deleteLeave")) +} // Mutation returns generated.MutationResolver implementation. func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} } diff --git a/internal/interfaces/graphql/resolver/query.resolvers.go b/internal/interfaces/graphql/resolver/query.resolvers.go index c95429a..d22dbe9 100644 --- a/internal/interfaces/graphql/resolver/query.resolvers.go +++ b/internal/interfaces/graphql/resolver/query.resolvers.go @@ -6,111 +6,94 @@ package resolver import ( "context" + "fmt" - "github.com/captain-corgi/go-graphql-example/internal/application/user" - "github.com/captain-corgi/go-graphql-example/internal/domain/errors" "github.com/captain-corgi/go-graphql-example/internal/interfaces/graphql/generated" "github.com/captain-corgi/go-graphql-example/internal/interfaces/graphql/model" ) // User is the resolver for the user field. func (r *queryResolver) User(ctx context.Context, id string) (*model.User, error) { - // Log operation start - r.logOperation(ctx, "User", map[string]interface{}{ - "id": id, - }) - - // Validate and sanitize input - sanitizedID := sanitizeString(id) - if err := r.validateInput(ctx, "User", func() error { - return validateUserID(sanitizedID) - }); err != nil { - return nil, err - } - - // Call application service - req := user.GetUserRequest{ID: sanitizedID} - resp, err := r.userService.GetUser(ctx, req) - if err != nil { - return nil, r.handleGraphQLError(ctx, err, "User") - } - - // Handle application-level errors - if len(resp.Errors) > 0 { - // Return the first error as GraphQL error - firstError := resp.Errors[0] - domainErr := errors.DomainError{ - Code: firstError.Code, - Message: firstError.Message, - Field: firstError.Field, - } - return nil, r.handleGraphQLError(ctx, domainErr, "User") - } - - // Map result to GraphQL model - result := mapUserDTOToGraphQL(resp.User) - r.logOperationSuccess(ctx, "User", result) - - return result, nil + panic(fmt.Errorf("not implemented: User - user")) } // Users is the resolver for the users field. func (r *queryResolver) Users(ctx context.Context, first *int, after *string) (*model.UserConnection, error) { - // Log operation start - r.logOperation(ctx, "Users", map[string]interface{}{ - "first": first, - "after": after, - }) - - // Validate pagination parameters - if err := r.validateInput(ctx, "Users", func() error { - return validatePaginationParams(first, after) - }); err != nil { - return nil, err - } - - // Sanitize after parameter - var sanitizedAfter string - if after != nil { - sanitizedAfter = sanitizeString(*after) - } - - // Set default first value - firstValue := 10 // Default page size - if first != nil { - firstValue = *first - } - - // Call application service - req := user.ListUsersRequest{ - First: firstValue, - After: sanitizedAfter, - } - resp, err := r.userService.ListUsers(ctx, req) - if err != nil { - return nil, r.handleGraphQLError(ctx, err, "Users") - } - - // Handle application-level errors - if len(resp.Errors) > 0 { - // Return the first error as GraphQL error - firstError := resp.Errors[0] - domainErr := errors.DomainError{ - Code: firstError.Code, - Message: firstError.Message, - Field: firstError.Field, - } - return nil, r.handleGraphQLError(ctx, domainErr, "Users") - } - - // Map result to GraphQL model - result := mapUserConnectionDTOToGraphQL(resp.Users) - r.logOperationSuccess(ctx, "Users", result) - - return result, nil + panic(fmt.Errorf("not implemented: Users - users")) } +// Employee is the resolver for the employee field. +func (r *queryResolver) Employee(ctx context.Context, id string) (*model.Employee, error) { + panic(fmt.Errorf("not implemented: Employee - employee")) +} + +// Employees is the resolver for the employees field. +func (r *queryResolver) Employees(ctx context.Context, first *int, after *string) (*model.EmployeeConnection, error) { + panic(fmt.Errorf("not implemented: Employees - employees")) +} + +// EmployeesByDepartment is the resolver for the employeesByDepartment field. +func (r *queryResolver) EmployeesByDepartment(ctx context.Context, department string, first *int, after *string) (*model.EmployeeConnection, error) { + panic(fmt.Errorf("not implemented: EmployeesByDepartment - employeesByDepartment")) +} + +// EmployeesByStatus is the resolver for the employeesByStatus field. +func (r *queryResolver) EmployeesByStatus(ctx context.Context, status string, first *int, after *string) (*model.EmployeeConnection, error) { + panic(fmt.Errorf("not implemented: EmployeesByStatus - employeesByStatus")) +} + +// Department is the resolver for the department field. +func (r *queryResolver) Department(ctx context.Context, id string) (*model.Department, error) { + // TODO: Implement department resolver + panic(fmt.Errorf("not implemented: Department - department")) +} + +// Departments is the resolver for the departments field. +func (r *queryResolver) Departments(ctx context.Context, first *int, after *string) (*model.DepartmentConnection, error) { + // TODO: Implement departments resolver + panic(fmt.Errorf("not implemented: Departments - departments")) +} + +// DepartmentsByManager is the resolver for the departmentsByManager field. +func (r *queryResolver) DepartmentsByManager(ctx context.Context, managerID string, first *int, after *string) (*model.DepartmentConnection, error) { + // TODO: Implement departments by manager resolver + panic(fmt.Errorf("not implemented: DepartmentsByManager - departmentsByManager")) +} +// Position is the resolver for the position field. +func (r *queryResolver) Position(ctx context.Context, id string) (*model.Position, error) { + panic(fmt.Errorf("not implemented: Position - position")) +} + +// Positions is the resolver for the positions field. +func (r *queryResolver) Positions(ctx context.Context, first *int, after *string) (*model.PositionConnection, error) { + panic(fmt.Errorf("not implemented: Positions - positions")) +} + +// PositionsByDepartment is the resolver for the positionsByDepartment field. +func (r *queryResolver) PositionsByDepartment(ctx context.Context, departmentID string, first *int, after *string) (*model.PositionConnection, error) { + panic(fmt.Errorf("not implemented: PositionsByDepartment - positionsByDepartment")) +} + +// Leave is the resolver for the leave field. +func (r *queryResolver) Leave(ctx context.Context, id string) (*model.Leave, error) { + panic(fmt.Errorf("not implemented: Leave - leave")) +} + +// Leaves is the resolver for the leaves field. +func (r *queryResolver) Leaves(ctx context.Context, first *int, after *string) (*model.LeaveConnection, error) { + panic(fmt.Errorf("not implemented: Leaves - leaves")) +} + +// LeavesByEmployee is the resolver for the leavesByEmployee field. +func (r *queryResolver) LeavesByEmployee(ctx context.Context, employeeID string, first *int, after *string) (*model.LeaveConnection, error) { + panic(fmt.Errorf("not implemented: LeavesByEmployee - leavesByEmployee")) +} + +// LeavesByStatus is the resolver for the leavesByStatus field. +func (r *queryResolver) LeavesByStatus(ctx context.Context, status string, first *int, after *string) (*model.LeaveConnection, error) { + panic(fmt.Errorf("not implemented: LeavesByStatus - leavesByStatus")) +} // Query returns generated.QueryResolver implementation. func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} } diff --git a/migrations/004_create_departments_table.down.sql b/migrations/004_create_departments_table.down.sql new file mode 100644 index 0000000..85b6b66 --- /dev/null +++ b/migrations/004_create_departments_table.down.sql @@ -0,0 +1,2 @@ +-- Drop departments table +DROP TABLE IF EXISTS departments; \ No newline at end of file diff --git a/migrations/004_create_departments_table.up.sql b/migrations/004_create_departments_table.up.sql new file mode 100644 index 0000000..7da36f7 --- /dev/null +++ b/migrations/004_create_departments_table.up.sql @@ -0,0 +1,21 @@ +-- Create departments table +CREATE TABLE departments ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(100) UNIQUE NOT NULL, + description TEXT NOT NULL, + manager_id UUID, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Create indexes for better query performance +CREATE INDEX idx_departments_name ON departments(name); +CREATE INDEX idx_departments_manager_id ON departments(manager_id); +CREATE INDEX idx_departments_created_at ON departments(created_at); +CREATE INDEX idx_departments_updated_at ON departments(updated_at); + +-- Create a trigger to automatically update the updated_at column +CREATE TRIGGER update_departments_updated_at + BEFORE UPDATE ON departments + FOR EACH ROW + EXECUTE FUNCTION update_updated_at_column(); \ No newline at end of file diff --git a/migrations/005_create_positions_table.down.sql b/migrations/005_create_positions_table.down.sql new file mode 100644 index 0000000..905100d --- /dev/null +++ b/migrations/005_create_positions_table.down.sql @@ -0,0 +1,2 @@ +-- Drop positions table +DROP TABLE IF EXISTS positions; \ No newline at end of file diff --git a/migrations/005_create_positions_table.up.sql b/migrations/005_create_positions_table.up.sql new file mode 100644 index 0000000..517e1da --- /dev/null +++ b/migrations/005_create_positions_table.up.sql @@ -0,0 +1,25 @@ +-- Create positions table +CREATE TABLE positions ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + title VARCHAR(100) UNIQUE NOT NULL, + description TEXT NOT NULL, + department_id UUID, + requirements TEXT NOT NULL, + min_salary DECIMAL(10,2) NOT NULL, + max_salary DECIMAL(10,2) NOT NULL, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + CONSTRAINT fk_positions_department_id FOREIGN KEY (department_id) REFERENCES departments(id) ON DELETE SET NULL +); + +-- Create indexes for better query performance +CREATE INDEX idx_positions_title ON positions(title); +CREATE INDEX idx_positions_department_id ON positions(department_id); +CREATE INDEX idx_positions_created_at ON positions(created_at); +CREATE INDEX idx_positions_updated_at ON positions(updated_at); + +-- Create a trigger to automatically update the updated_at column +CREATE TRIGGER update_positions_updated_at + BEFORE UPDATE ON positions + FOR EACH ROW + EXECUTE FUNCTION update_updated_at_column(); \ No newline at end of file diff --git a/migrations/006_create_leaves_table.down.sql b/migrations/006_create_leaves_table.down.sql new file mode 100644 index 0000000..e9430dc --- /dev/null +++ b/migrations/006_create_leaves_table.down.sql @@ -0,0 +1,2 @@ +-- Drop leaves table +DROP TABLE IF EXISTS leaves; \ No newline at end of file diff --git a/migrations/006_create_leaves_table.up.sql b/migrations/006_create_leaves_table.up.sql new file mode 100644 index 0000000..c30ad47 --- /dev/null +++ b/migrations/006_create_leaves_table.up.sql @@ -0,0 +1,32 @@ +-- Create leaves table +CREATE TABLE leaves ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + employee_id UUID NOT NULL, + leave_type VARCHAR(20) NOT NULL CHECK (leave_type IN ('VACATION', 'SICK', 'PERSONAL', 'MATERNITY', 'PATERNITY', 'BEREAVEMENT', 'UNPAID', 'OTHER')), + start_date DATE NOT NULL, + end_date DATE NOT NULL, + reason TEXT NOT NULL, + status VARCHAR(20) NOT NULL DEFAULT 'PENDING' CHECK (status IN ('PENDING', 'APPROVED', 'REJECTED', 'CANCELLED')), + approved_by UUID, + approved_at TIMESTAMP WITH TIME ZONE, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + CONSTRAINT fk_leaves_employee_id FOREIGN KEY (employee_id) REFERENCES employees(id) ON DELETE CASCADE, + CONSTRAINT fk_leaves_approved_by FOREIGN KEY (approved_by) REFERENCES employees(id) ON DELETE SET NULL, + CONSTRAINT check_leaves_date_range CHECK (start_date <= end_date) +); + +-- Create indexes for better query performance +CREATE INDEX idx_leaves_employee_id ON leaves(employee_id); +CREATE INDEX idx_leaves_status ON leaves(status); +CREATE INDEX idx_leaves_start_date ON leaves(start_date); +CREATE INDEX idx_leaves_end_date ON leaves(end_date); +CREATE INDEX idx_leaves_approved_by ON leaves(approved_by); +CREATE INDEX idx_leaves_created_at ON leaves(created_at); +CREATE INDEX idx_leaves_updated_at ON leaves(updated_at); + +-- Create a trigger to automatically update the updated_at column +CREATE TRIGGER update_leaves_updated_at + BEFORE UPDATE ON leaves + FOR EACH ROW + EXECUTE FUNCTION update_updated_at_column(); \ No newline at end of file