Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
lua.space/models/job.lua
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
50 lines (43 sloc)
1.36 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local job = {} | |
| local v = require "valua" | |
| job.types = { | |
| "Contract", | |
| "Internship", | |
| "Part-time", | |
| "Full-time", | |
| "Part or Full-time" | |
| } | |
| job.formTypes = (function() local jt = {} | |
| for _,t in ipairs(job.types) do | |
| jt[t] = t | |
| end | |
| return jt | |
| end)() | |
| job.attributes = { | |
| { id = "safe"}, | |
| { title = v:new().not_empty().len(10,100) }, | |
| { description = v:new().not_empty().len(10,5000) }, | |
| { type = v:new().not_empty().in_list(job.types) }, | |
| { length = v:new().integer() }, -- 0 or empty assumes indefinite | |
| { salary_range_min = v:new().len(0,50) }, | |
| { salary_range_max = v:new().len(0,50) }, | |
| { location = v:new().len(0,200) }, | |
| { employer = v:new().not_empty().len(5,100) }, | |
| { employers_website = v:new().not_empty().len(1,2083).match('^https?://[%w]+%.[%w]+.*') }, | |
| { skills_required = v:new().len(0,5000) }, | |
| { skills_desired = v:new().len(0,5000) }, | |
| { about_company = v:new().not_empty().len(10,5000) }, | |
| { benefits = v:new().len(0,5000) }, | |
| { how_to_apply = v:new().not_empty().len(10,5000) }, | |
| { email = v:new().not_empty().email() }, | |
| { posted_date = v:new().not_empty() }, | |
| { allow_remote = v:new().boolean() }, | |
| { visa_sponsoring = v:new().boolean() }, | |
| { relocation_aid = v:new().boolean() }, | |
| { approved = v:new().boolean() } | |
| } | |
| job.db = { | |
| key = 'id', -- the primary key | |
| table = 'jobs' -- make sure this field contains the same name as your SQL table! | |
| } | |
| return job |