jobs

package module
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 11 Imported by: 0

README

Jobs Package

Our Jobs Template is built on NextJS and React, offering a modern and efficient solution for job listing and applicant management. This template is designed to seamlessly integrate with spurtCMS Admin, providing a robust platform for managing job-related content.

Features

  • Integration with spurtCMS Admin: Use the template seamlessly with spurtCMS Admin to manage job listings, applicant details, and other job-related content efficiently.
  • Standalone Usage: The Jobs Template can also be used independently, allowing for flexibility in content management according to your specific needs.
  • Dynamic Job Listings: Easily create, edit, and delete job listings, complete with detailed information about qualifications, salary, and more.
  • Applicant Management: Track and manage applicant statuses, view applications, and streamline the recruitment process.

Installation

go get github.com/spurtcms/jobs

Usage Example

func main() {

	Auth := auth.AuthSetup(auth.Config{
		UserId:     1,
		ExpiryTime: 2,
		SecretKey:  "Secret123",
		RoleId:     1,
		DB:         &gorm.DB{},
	})
	token, _ := Auth.CreateToken()

	Auth.VerifyToken(token, Auth.SecretKey)

	permisison, _ := Auth.IsGranted("Jobs", auth.CRUD)

	Jobs := jobs.JobsSetup(jobs.Config{

		DB:               &gorm.DB{},
		AuthEnable:       true,
		PermissionEnable: true,
		Auth:             Auth,
	})

	if permisison {

		//List Jobs
		jobslist, totalcount, err := Jobs.JobsList(10, 0, jobs.Filter{})

		fmt.Println(jobslist, totalcount, err)

		//Create new job
		cerr := Jobs.CreateJob(jobs.CreateJobReq{JobTitle: "Developer", JobDescription: "developing, coding, installing, and maintaining software systems.", JobType: "Full-Time", JobLocation: "Chennai"})

		if cerr != nil {

			fmt.Println(cerr)
		}
		//Update Job
		uerr := Jobs.UpdateJob(jobs.CreateJobReq{JobTitle: "Manager", JobDescription: "Develops, coordinates, and enforces systems, policies, procedures, and productivity", JobType: "Hybrid-Work", JobLocation: "Bangalore", Id: 1})

		if uerr != nil {

			fmt.Println(uerr)
		}
		//Delete job
		derr := Jobs.DeleteJob(1, 1)

		if derr != nil {

			fmt.Println(derr)
		}

	} else {

		fmt.Println("unauthroized")
	}

	apermisison, _ := Auth.IsGranted("Applicants", auth.CRUD)

		if apermisison {
	
			//List applicants
			applicantlist, totalcount, err := Jobs.ApplicantsList(10, 0, jobs.Filter{})
	
			fmt.Println(applicantlist, totalcount, err)
	       //Create applicant
			cerr := Jobs.CreateApplicant(jobs.CreateApplicantReq{Name: "Joe",Education: "BE",Experience: 2,JobType: "Full-Time"})
	
			if cerr != nil {
	
				fmt.Println(cerr)
			}
	       //Update applicant
			uerr := Jobs.UpdateApplicant(jobs.CreateApplicantReq{Name: "John",Education: "Bsc",Experience: 1,JobType: "Remote-Work"},1 )
	
			if uerr != nil {
	
				fmt.Println(uerr)
			}
	        //Delete applicant
			derr := Jobs.DeleteApplicant(1, 1)
	
			if derr != nil {
	
				fmt.Println(derr)
			}
	
		} else {
	
			fmt.Println("unauthroized")
		}
}



Getting help

If you encounter a problem with the package,please refer [Please refer [(https://www.spurtcms.com/documentation/spurtcms)] or you can create a new Issue in this repo[https://github.com/spurtcms/jobs/issues].

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorAuth       = errors.New("auth enabled not initialised")
	ErrorPermission = errors.New("permissions enabled not initialised")
	ErrorEmpty      = errors.New("given some values is empty")
	TZONE, _        = time.LoadLocation(os.Getenv("TIME_ZONE"))
)

Functions

func AuthandPermission

func AuthandPermission(jobs *Jobs) error

func HashingPassword

func HashingPassword(pass string) string

Types

type ApplicantDetails added in v0.0.13

type ApplicantDetails struct {
	ID             int
	JobID          int
	ApplicantID    int
	Name           string
	EmailID        string
	MobileNo       string
	JobType        string
	Gender         string
	Location       string
	Education      string
	Graduation     int
	CompanyName    string
	Experience     int
	Skills         string
	ImagePath      string
	Image          string
	CreatedOn      time.Time
	CreatedBy      int
	ModifiedOn     time.Time
	ModifiedBy     int
	IsDeleted      int
	DeletedOn      time.Time
	DeletedBy      int
	CurrentSalary  int
	ExpectedSalary int
	Status         int
	ResumePath     string
	ResumeName     string
	StorageType    string
}

type Config

type Config struct {
	DB               *gorm.DB
	AuthEnable       bool
	PermissionEnable bool
	DataBaseType     Type
	Auth             *auth.Auth
	Permissions      *role.PermissionConfig
}

type CreateApplicantReq

type CreateApplicantReq struct {
	Id             int
	MemberId       int
	Name           string
	EmailId        string
	MobileNo       string
	JobType        string
	Location       string
	Education      string
	Graduation     int
	CompanyName    string
	Experience     int
	Skills         string
	ImagePath      string
	Image          string
	CreatedBy      int
	ModifiedBy     int
	DeletedBy      int
	CurrentSalary  int
	ExpectedSalary int
	Status         int
	Password       string
	StorageType    string
}

type CreateJobReq

type CreateJobReq struct {
	Id             int
	CategoriesId   int
	JobTitle       string
	JobSlug        string
	JobDescription string
	JobLocation    string
	JobType        string
	Education      string
	Department     string
	Experience     string
	Salary         string
	CreatedBy      int
	DeletedBy      int
	Keywords       string
	Skill          string
	MinimumYears   int
	MaximumYears   int
	PostedDate     time.Time
	ValidThrough   time.Time
	Status         int
	ModifiedBy     int
}

type Filter

type Filter struct {
	Keyword        string
	JobType        string
	Name           string
	EmailId        string
	MobileNo       string
	JobId          int
	Status         string
	ApplicantName  string
	ApplicantEmail string
	Experience     int
	JobTitle       string
	JobLocation    string
	CategoryId     int
	CategorySlug   string
	KeyWord        string
	MinimumYears   int
	MaximumYears   int
	DatePosted     string
	Skill          string
}

type Jobs

type Jobs struct {
	AuthEnable       bool
	PermissionEnable bool
	AuthFlg          bool
	PermissionFlg    bool
	DB               *gorm.DB
	Auth             *auth.Auth
	Permissions      *role.PermissionConfig
	DataBaseType     Type
	Userid           int
	Dataaccess       int
}

func JobsSetup added in v0.0.2

func JobsSetup(config Config) *Jobs

JobsSetup used initialize Jobs configruation

func (*Jobs) ApplicantsList

func (Ap *Jobs) ApplicantsList(limit, offset int, filter Filter) (applicants []TblJobsApplicants, count int64, err error)

Applicant List Function//

func (*Jobs) ChangeApplicantStatus added in v0.0.7

func (Ap *Jobs) ChangeApplicantStatus(jobid int, applicantid int, status string) error

func (*Jobs) CheckAlreadyRegistered added in v0.0.13

func (jobs *Jobs) CheckAlreadyRegistered(jobId int, emailId string) (count int64, err error)

func (*Jobs) CreateApplicant

func (Ap *Jobs) CreateApplicant(ap CreateApplicantReq) error

func (*Jobs) CreateJob

func (Ap *Jobs) CreateJob(Jc CreateJobReq) error

func (*Jobs) CreateJobApplication added in v0.0.13

func (jobs *Jobs) CreateJobApplication(applicationData ApplicantDetails) error

func (*Jobs) DeleteApplicant

func (Ap *Jobs) DeleteApplicant(memberid int, userid int) error

func (*Jobs) DeleteJob

func (Ap *Jobs) DeleteJob(id int, userid int) error

func (*Jobs) GetApplicantById

func (Ap *Jobs) GetApplicantById(id int) (ap TblJobsApplicants, err error)

func (*Jobs) GetApplicantDetails added in v0.0.13

func (jobs *Jobs) GetApplicantDetails(jobId, memberId int, emailId string) (applicantDetails ApplicantDetails, err error)

func (*Jobs) GetApplicantJobs

func (Ap *Jobs) GetApplicantJobs(ApplicantId int, limit int, offset int) (applicantjobs []TblJobsRegisters, Totaljobs int64, err error)

func (*Jobs) GetJobApplicant

func (Ap *Jobs) GetJobApplicant(id int, limit, offset int, filter Filter) (app []TblJobs, Totalapplicants int64, err error)

func (*Jobs) GetJobById

func (Ap *Jobs) GetJobById(id int) (job TblJobs, err error)

func (*Jobs) GetJobDetails added in v0.0.8

func (jobs *Jobs) GetJobDetails(id int, jobSlug string) (jobDetail TblJobs, err error)

func (*Jobs) GetJobsList added in v0.0.8

func (jobs *Jobs) GetJobsList(limit int, offset int, filter Filter) (jobsList []TblJobs, count int64, err error)

func (*Jobs) JobsList

func (Ap *Jobs) JobsList(limit, offset int, filter Filter) (job []TblJobs, count int64, err error)

Jobs List Function

func (*Jobs) MultiSelectApplicantStatus

func (Ap *Jobs) MultiSelectApplicantStatus(memberid []int, status int, modifiedby int) (bool, error)

multiselecte member status change

func (*Jobs) MultiSelectJobsStatus

func (Ap *Jobs) MultiSelectJobsStatus(memberid []int, status int, modifiedby int) (bool, error)

multiselecte member status change

func (*Jobs) MultiSelectedApplicantDelete

func (Ap *Jobs) MultiSelectedApplicantDelete(applicantids []int, modifiedby int) (bool, error)

func (*Jobs) MultiSelectedJobDelete

func (Ap *Jobs) MultiSelectedJobDelete(jobids []int, modifiedby int) (bool, error)

func (*Jobs) UpdateApplicant

func (Ap *Jobs) UpdateApplicant(ap CreateApplicantReq, memberid int) error

func (*Jobs) UpdateJob

func (Ap *Jobs) UpdateJob(Jc CreateJobReq) error

type JobsListReq added in v0.0.4

type JobsListReq struct {
	Limit  int
	Offset int
}

type JobsModel

type JobsModel struct {
	Dataaccess int
	Userid     int
}
var Jobsmodel JobsModel

func (JobsModel) ApplicantCreate

func (jobsmodel JobsModel) ApplicantCreate(applicant TblJobsApplicants, DB *gorm.DB) error

func (JobsModel) ApplicantDelete

func (jobmodel JobsModel) ApplicantDelete(applicant TblJobsApplicants, DB *gorm.DB) error

func (JobsModel) ApplicantUpdate

func (jobsmodel JobsModel) ApplicantUpdate(applicant *TblJobsApplicants, DB *gorm.DB) error

func (JobsModel) ApplicantsList

func (jobsmodel JobsModel) ApplicantsList(limit int, offset int, filter Filter, DB *gorm.DB) (applicant []TblJobsApplicants, Totalapplicants int64, err error)

func (JobsModel) ChangeApplicantStatus added in v0.0.7

func (jobsmodel JobsModel) ChangeApplicantStatus(jobid int, applicantid int, status string, DB *gorm.DB) error

func (JobsModel) CheckAlreadyRegistered added in v0.0.13

func (jobsModel JobsModel) CheckAlreadyRegistered(jobId int, emailId string, DB *gorm.DB) (count int64, err error)

func (JobsModel) CreateJobApplication added in v0.0.13

func (jobsModel JobsModel) CreateJobApplication(applicationData ApplicantDetails, DB *gorm.DB) error

func (JobsModel) GetApplicantById

func (jobsmodel JobsModel) GetApplicantById(id int, DB *gorm.DB) (applicant TblJobsApplicants, err error)

func (JobsModel) GetApplicantDetails added in v0.0.13

func (jobsModel JobsModel) GetApplicantDetails(jobId, memberId int, emailId string, DB *gorm.DB) (applicantDetails ApplicantDetails, err error)

func (JobsModel) GetApplicantJobs

func (jobmodel JobsModel) GetApplicantJobs(applicantid int, limit int, offset int, DB *gorm.DB) (applicantjobs []TblJobsRegisters, Totaljobs int64, err error)

func (JobsModel) GetJobApplicantByJobId

func (jobsmodel JobsModel) GetJobApplicantByJobId(id int, limit int, offset int, filter Filter, DB *gorm.DB) (applicant []TblJobs, Totalapplicants int64, err error)

func (JobsModel) GetJobDetails added in v0.0.8

func (jobsModel JobsModel) GetJobDetails(id int, jobSlug string, DB *gorm.DB) (jobDetail TblJobs, err error)

func (JobsModel) GetJobsList added in v0.0.8

func (jobsModel JobsModel) GetJobsList(limit int, offset int, filter Filter, DB *gorm.DB) (jobsList []TblJobs, count int64, err error)

func (JobsModel) JobCreate

func (jobsmodel JobsModel) JobCreate(job *TblJobs, DB *gorm.DB) error

func (JobsModel) JobDelete

func (jobsmodel JobsModel) JobDelete(job *TblJobs, DB *gorm.DB) error

func (JobsModel) JobDetailsById

func (jobsmodel JobsModel) JobDetailsById(jobs *TblJobs, id int, DB *gorm.DB) error

func (JobsModel) JobUpdate

func (jobsmodel JobsModel) JobUpdate(job *TblJobs, DB *gorm.DB) error

func (JobsModel) JobsList

func (jobsmodel JobsModel) JobsList(limit int, offset int, filter Filter, DB *gorm.DB) (job []TblJobs, Totaljob int64, err error)

func (JobsModel) MultiApplicantIsActive

func (jobsmodel JobsModel) MultiApplicantIsActive(applicant *TblJobsApplicants, jobid []int, status int, DB *gorm.DB) error

func (JobsModel) MultiJobsIsActive

func (jobsmodel JobsModel) MultiJobsIsActive(job *TblJobs, jobid []int, status int, DB *gorm.DB) error

func (JobsModel) MultiSelectedApplicantDelete

func (jobsmodel JobsModel) MultiSelectedApplicantDelete(applicant *TblJobsApplicants, id []int, DB *gorm.DB) error

func (JobsModel) MultiSelectedJobDelete

func (jobsmodel JobsModel) MultiSelectedJobDelete(job *TblJobs, id []int, DB *gorm.DB) error

type TblJobs

type TblJobs struct {
	Id             int                        `gorm:"primaryKey;auto_increment;type:serial"`
	CategoriesId   int                        `gorm:"type:integer"`
	Category       categories.TblCategories   `gorm:"foreignKey:Id;"`
	JobTitle       string                     `gorm:"type:character varying"`
	JobDescription string                     `gorm:"type:character varying"`
	JobLocation    string                     `gorm:"type:character varying"`
	JobType        string                     `gorm:"type:character varying"`
	Education      string                     `gorm:"type:character varying"`
	Department     string                     `gorm:"type:character varying"`
	Experience     string                     `gorm:"type:character varying"`
	Salary         string                     `gorm:"type:character varying"`
	CreatedOn      time.Time                  `gorm:"type:timestamp without time zone;DEFAULT:NULL"`
	CreatedBy      int                        `gorm:"type:integer"`
	CreatedDate    string                     `gorm:"-:migration;<-:false"`
	IsDeleted      int                        `gorm:"type:integer"`
	DeletedOn      time.Time                  `gorm:"DEFAULT:NULL"`
	DeletedBy      int                        `gorm:"DEFAULT:NULL"`
	ApplicantsList []TblJobsApplicants        `gorm:"foreignKey:Id;"`
	Keywords       string                     `gorm:"type:character varying"`
	Skill          string                     `gorm:"type:character varying"`
	MinimumYears   int                        `gorm:"type:integer"`
	MaximumYears   int                        `gorm:"type:integer"`
	PostedDate     time.Time                  `gorm:"type:timestamp without time zone;DEFAULT:NULL"`
	ValidThrough   time.Time                  `gorm:"type:timestamp without time zone;DEFAULT:NULL"`
	Status         int                        `gorm:"type:integer"`
	Startdate      string                     `gorm:"-:migration;<-:false"`
	Enddate        string                     `gorm:"-:migration;<-:false"`
	ModifiedOn     time.Time                  `gorm:"type:timestamp without time zone;DEFAULT:NULL"`
	ModifiedBy     int                        `gorm:"type:integer"`
	CategoryNames  []categories.TblCategories `gorm:"-"`
	JobList        []TblJobsRegisters         `gorm:"foreignKey:Id;"`
	Jobregstatus   string                     `gorm:"-:migration;<-:false"`
	JobSlug        string                     `gorm:"type:character varying"`
}

type TblJobsApplicants

type TblJobsApplicants struct {
	Id             int       `gorm:"primaryKey;auto_increment;type:serial"`
	MemberId       int       `gorm:"type:integer"`
	Name           string    `gorm:"type:character varying"`
	EmailId        string    `gorm:"type:character varying"`
	MobileNo       string    `gorm:"type:character varying"`
	JobType        string    `gorm:"type:character varying"`
	Location       string    `gorm:"type:character varying"`
	Education      string    `gorm:"type:character varying"`
	Graduation     int       `gorm:"type:integer"`
	CompanyName    string    `gorm:"type:character varying"`
	Experience     int       `gorm:"type:integer"`
	Skills         string    `gorm:"type:character varying"`
	ImagePath      string    `gorm:"type:character varying"`
	Image          string    `gorm:"type:character varying"`
	CreatedOn      time.Time `gorm:"type:timestamp without time zone;DEFAULT:NULL"`
	CreatedBy      int
	ModifiedOn     time.Time `gorm:"DEFAULT:NULL"`
	ModifiedBy     int
	IsDeleted      int
	DeletedOn      time.Time `gorm:"DEFAULT:NULL"`
	DeletedBy      int
	CreatedDate    string `gorm:"-:migration;<-:false"`
	CurrentSalary  int    `gorm:"type:integer"`
	ExpectedSalary int    `gorm:"type:integer"`
	Status         int    `gorm:"type:integer"`
	NameString     string `gorm:"-:migration;<-:false"`
	Password       string
	ResumePath     string `gorm:"type:character varying"`
	ResumeName     string `gorm:"type:character varying"`
	Jobregstatus   string `gorm:"-:migration;<-:false"`
	StorageType    string `gorm:"type:character varying"`
}

type TblJobsDepartment

type TblJobsDepartment struct {
	Id         int    `gorm:"primaryKey;auto_increment;type:serial"`
	Department string `gorm:"type:character varying"`
}

type TblJobsEducation

type TblJobsEducation struct {
	Id        int    `gorm:"primaryKey;auto_increment;type:serial"`
	Education string `gorm:"type:character varying"`
}

type TblJobsRegisters

type TblJobsRegisters struct {
	Id             int `gorm:"primaryKey;auto_increment;type:serial"`
	JobId          int
	ApplicantId    int
	CreatedBy      int                 `gorm:"type:integer"`
	CreatedOn      time.Time           `gorm:"type:timestamp without time zone;DEFAULT:NULL"`
	ApplicantsList []TblJobsApplicants `gorm:"foreignKey:Id;"`
	JobList        []TblJobs           `gorm:"foreignKey:Id;"`
	CreatedDate    string              `gorm:"-:migration;<-:false"`
	Status         string              `gorm:"type:character varying"`
}

type Type

type Type string
const (
	Postgres Type = "postgres"
	Mysql    Type = "mysql"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL