JobPlatformapp.js16 matches
21init();
2223async function init() {
24// Set view source link
25setViewSourceLink();
41}
4243function setViewSourceLink() {
44// Get the current URL and convert it to Val Town URL
45const currentUrl = window.location.href;
4950// Event Listeners
51function setupEventListeners() {
52// Job form submission
53jobForm.addEventListener('submit', async (e) => {
82}
8384// Job Functions
85async function loadJobs() {
86try {
87const response = await fetch('/api/jobs');
111}
112113async function submitJobPosting() {
114try {
115const formData = {
148}
149150// Chat Functions
151function enableChat() {
152usernameContainer.innerHTML = `<p class="text-sm text-gray-600">Chatting as: <span class="font-semibold">${escapeHtml(username)}</span> <button id="change-username" class="text-blue-600 text-xs hover:underline">Change</button></p>`;
153
185}
186187async function loadChatMessages() {
188try {
189const response = await fetch('/api/chat');
210}
211212function renderChatMessages(messages) {
213chatMessages.innerHTML = messages.map(msg => `
214<div class="chat-message ${msg.username === username ? 'text-right' : ''}">
225}
226227function startChatPolling() {
228// Clear any existing interval
229if (chatPollingInterval) {
273}
274275async function sendChatMessage() {
276const message = chatInput.value.trim();
277if (!message || !username) return;
306}
307308// Utility Functions
309function formatDate(timestamp) {
310if (!timestamp) return 'Unknown';
311
318}
319320function formatTime(timestamp) {
321if (!timestamp) return '';
322
328}
329330function escapeHtml(str) {
331if (!str) return '';
332return str
JobPlatformqueries.ts6 matches
2021// Job posting queries
22export async function createJob(job: JobPosting): Promise<number> {
23const result = await sqlite.execute(
24`INSERT INTO ${JOBS_TABLE} (title, company, description, contact)
30}
3132export async function getJobs(): Promise<JobPosting[]> {
33const result = await sqlite.execute(
34`SELECT * FROM ${JOBS_TABLE} ORDER BY created_at DESC`
37}
3839export async function getJob(id: number): Promise<JobPosting | null> {
40const result = await sqlite.execute(
41`SELECT * FROM ${JOBS_TABLE} WHERE id = ?`,
4647// Chat message queries
48export async function createChatMessage(message: ChatMessage): Promise<number> {
49const result = await sqlite.execute(
50`INSERT INTO ${CHAT_TABLE} (username, message)
56}
5758export async function getChatMessages(limit = 50): Promise<ChatMessage[]> {
59const result = await sqlite.execute(
60`SELECT * FROM ${CHAT_TABLE}
66}
6768export async function getRecentChatMessages(
69since: number,
70limit = 50
JobPlatformmigrations.ts1 match
8* Run database migrations to set up the schema
9*/
10export async function runMigrations() {
11// Create jobs table
12await sqlite.execute(`
JobPlatformREADME.md1 match
19โ โโโ database/
20โ โ โโโ migrations.ts # Schema definitions
21โ โ โโโ queries.ts # DB query functions
22โ โโโ routes/ # Route modules
23โ โ โโโ jobs.ts # Job posting endpoints
67- `types.ts` - TypeScript interfaces and types used throughout the application
8- `utils.ts` - Utility functions used by both frontend and backend
910## Types
AkashJobForm.tsx1 match
377- Design and implement new features for our web applications
378- Write clean, maintainable, and efficient code
379- Collaborate with cross-functional teams to define and implement new features
380- Troubleshoot and fix bugs in existing applications
381- Mentor junior developers and conduct code reviews`,
8* Scores a resume against job requirements
9*/
10export function scoreResume(resume: Resume, jobRequirement: JobRequirement): ScoringResult {
11if (!resume.parsedData) {
12throw new Error("Resume must be parsed before scoring");
57* Calculates skill matches between resume skills and job requirements
58*/
59function calculateSkillMatches(
60candidateSkills: string[],
61requiredSkills: string[],
110* Calculates experience relevance based on job title and description
111*/
112function calculateExperienceRelevance(
113experiences: { company: string; title: string; description: string }[],
114jobTitle: string,
135* Calculates education relevance (simplified)
136*/
137function calculateEducationRelevance(
138education: { institution: string; degree: string; field?: string }[]
139): number {
166* Uses AI to generate personalized feedback for a candidate
167*/
168export async function generateCandidateFeedback(
169resume: Resume,
170jobRequirement: JobRequirement,
7* Parses resume text using OpenAI to extract structured information
8*/
9export async function parseResume(resumeText: string): Promise<ParsedResumeData> {
10try {
11const prompt = `
85* Extracts contact information from resume text
86*/
87export async function extractContactInfo(resumeText: string): Promise<{ name: string; email: string; phone?: string }> {
88try {
89const prompt = `
Akashdatabase.ts9 matches
78// Initialize database tables
9export async function initDatabase() {
10// Create resumes table
11await sqlite.execute(`
3738// Resume operations
39export async function saveResume(resume: Resume): Promise<number> {
40const { candidateName, email, phone, resumeText, parsedData, score, createdAt } = resume;
41
59}
6061export async function getResume(id: number): Promise<Resume | null> {
62const result = await sqlite.execute(
63`SELECT * FROM ${RESUMES_TABLE} WHERE id = ?`,
82}
8384export async function getAllResumes(): Promise<Resume[]> {
85const result = await sqlite.execute(`SELECT * FROM ${RESUMES_TABLE} ORDER BY createdAt DESC`);
86
97}
9899export async function updateResumeScore(id: number, score: number): Promise<void> {
100await sqlite.execute(
101`UPDATE ${RESUMES_TABLE} SET score = ? WHERE id = ?`,
104}
105106export async function updateParsedData(id: number, parsedData: ParsedResumeData): Promise<void> {
107await sqlite.execute(
108`UPDATE ${RESUMES_TABLE} SET parsedData = ? WHERE id = ?`,
112113// Job requirement operations
114export async function saveJobRequirement(job: JobRequirement): Promise<number> {
115const { title, description, requiredSkills, preferredSkills, minimumExperience, createdAt } = job;
116
133}
134135export async function getJobRequirement(id: number): Promise<JobRequirement | null> {
136const result = await sqlite.execute(
137`SELECT * FROM ${JOB_REQUIREMENTS_TABLE} WHERE id = ?`,
155}
156157export async function getAllJobRequirements(): Promise<JobRequirement[]> {
158const result = await sqlite.execute(`SELECT * FROM ${JOB_REQUIREMENTS_TABLE} ORDER BY createdAt DESC`);
159
1// Shared utility functions for both frontend and backend
23/**
5* Simple implementation for demonstration purposes
6*/
7export function calculateSimilarity(str1: string, str2: string): number {
8const s1 = str1.toLowerCase();
9const s2 = str2.toLowerCase();
27* Formats a date string to a readable format
28*/
29export function formatDate(dateString: string): string {
30if (!dateString) return '';
31
45* Validates an email address
46*/
47export function isValidEmail(email: string): boolean {
48const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
49return emailRegex.test(email);
54* This is a simple implementation - in production, you'd use NLP
55*/
56export function extractSkills(text: string, skillsList: string[]): string[] {
57const textLower = text.toLowerCase();
58return skillsList.filter(skill =>
64* Truncates text to a specified length
65*/
66export function truncateText(text: string, maxLength: number): string {
67if (text.length <= maxLength) return text;
68return text.substring(0, maxLength) + '...';