Skip to content

Commit

Permalink
gitMerge branch 'master' of https://github.com/dayoonasanya/forjobseeker
Browse files Browse the repository at this point in the history
  • Loading branch information
dayoonasanya committed Oct 15, 2024
2 parents 9553761 + b69ad20 commit d3cd7d6
Show file tree
Hide file tree
Showing 16 changed files with 319 additions and 36 deletions.
299 changes: 294 additions & 5 deletions backend/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
"@prisma/client": "^5.18.0",
"@types/express": "^4.17.21",
"@types/multer": "^1.4.11",
"axios": "^1.7.7",
"bcrypt": "^5.1.1",
"bcryptjs": "^2.4.3",
"cheerio": "^1.0.0",
"cloudinary": "^2.2.0",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
Expand Down
6 changes: 3 additions & 3 deletions backend/rest/auth.http
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Register a new user (JobSeeker)
POST http://localhost:5000/api/auth/register
POST https://forjobseeker-rv9r.onrender.com/api/auth/register
Content-Type: application/json

{
Expand All @@ -15,7 +15,7 @@ Content-Type: application/json
}

### Register a new user (Company)
POST http://localhost:5000/api/auth/register
POST https://forjobseeker-rv9r.onrender.com/api/auth/register
Content-Type: application/json

{
Expand All @@ -30,7 +30,7 @@ Content-Type: application/json
}

### Login user
POST http://localhost:5000/api/auth/login
POST https://forjobseeker-rv9r.onrender.com/api/auth/login
Content-Type: application/json

{
Expand Down
8 changes: 0 additions & 8 deletions backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ import workExperienceRoutes from './routes/workexperience.routes';

const app = express();

// Middleware Setup
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(helmet());
app.use(morgan('combined', { stream: { write: (message) => logger.info(message.trim()) } }));

// CORS Configuration
const corsOptions = {
origin: '*',
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
Expand All @@ -32,7 +30,6 @@ const corsOptions = {

app.use(cors(corsOptions));

// API Routes
app.use('/api/auth', authRoutes);
app.use('/api/applications', applicationRoutes);
app.use('/api/certifications', certificationRoutes);
Expand All @@ -43,30 +40,25 @@ app.use('/api/jobseekers', jobSeekerRoutes);
app.use('/api/search', searchRoutes);
app.use('/api/workexperience', workExperienceRoutes);

// Health Check Route
app.get('/health', (req: Request, res: Response) => {
res.status(200).json({ status: 'Server is up and running' });
});

// Handle 404 Errors
app.use((req: Request, res: Response, next: NextFunction) => {
res.status(404).json({ message: 'Route not found' });
});

// Start the Server
const server: Server = app.listen(env.port, () => {
logger.info(`Server started on port ${env.port}`);
});

// Graceful Shutdown
const gracefulShutdown = () => {
logger.info('Received shutdown signal. Shutting down gracefully...');
server.close(() => {
logger.info('Server closed. Exiting process...');
process.exit(0);
});

// Forceful shutdown if the server does not close within 10 seconds
setTimeout(() => {
logger.error('Forcefully shutting down...');
process.exit(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<div *ngFor="let application of applications; let i = index" class="bg-white shadow-lg border-dashed border-2 border-gray-300 rounded-lg p-6 w-[70%] mx-auto">
<!-- Numbering the card -->
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-gray-800 mb-2">#{{ i + 1 }}: {{ application.job?.title || 'Job Title Not Available' }}</h3>
<h3 class="text-lg font-semibold text-gray-800 mb-2">#{{ i + 1 }}: {{ application.job.title || 'Job Title Not Available' }}</h3>
</div>

<!-- Company and Status -->
<p class="text-sm text-gray-600 mb-2">Company: {{ application.job?.company?.name || 'Company Not Available' }}</p>
<p class="text-sm text-gray-600 mb-2">Company: {{ application.job.company.name || 'Company Not Available' }}</p>

<p class="text-sm text-gray-600 mb-2">Status:
<span
Expand All @@ -37,10 +37,10 @@ <h3 class="text-lg font-semibold text-gray-800 mb-2">#{{ i + 1 }}: {{ applicatio
<p class="text-sm text-gray-600 mb-2">Date Applied: {{ application.appliedAt | date }}</p>

<!-- Job Seeker Name -->
<p class="text-sm text-gray-600 mb-2">Job Seeker: {{ application.jobSeeker?.firstName }} {{ application.jobSeeker?.lastName }}</p>
<p class="text-sm text-gray-600 mb-2">Job Seeker: {{ application.jobSeeker.firstName }} {{ application.jobSeeker.lastName }}</p>

<!-- View Job Details Link -->
<a routerLink="/jobs/{{ application.job?.id }}" class="text-blue-500 hover:underline mt-2 inline-block">View Job Details</a>
<a routerLink="/jobs/{{ application.job.id }}" class="text-blue-500 hover:underline mt-2 inline-block">View Job Details</a>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h3 class="text-lg font-semibold text-gray-700 mb-2">Social Links:</h3>
<!-- Skills -->
<div class="mb-6">
<h3 class="text-lg font-semibold text-gray-700 mb-2">Skills:</h3>
<p class="text-gray-800">{{ jobSeeker.skills?.join(', ') }}</p>
<p class="text-gray-800">{{ jobSeeker.skills.join(', ') }}</p>
</div>

<!-- CV Link -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
<!-- Job Header -->
<div class="bg-gray-100 p-6 flex items-center justify-between">
<div class="flex items-center">
<img [src]="job.company?.logo || '/assets/default-company-logo.png'" alt="Company Logo" class="w-16 h-16 object-contain mr-4">
<img [src]="job.company.logo || '/assets/default-company-logo.png'" alt="Company Logo" class="w-16 h-16 object-contain mr-4">
<div>
<h1 class="text-3xl font-bold text-gray-800">{{ job.title }}</h1>
<p class="text-xl text-gray-600">{{ job.company?.name }}</p>
<p class="text-xl text-gray-600">{{ job.company.name }}</p>
</div>
</div>
<button (click)="applyForJob()" class="bg-red-600 hover:bg-red-700 text-white font-bold py-2 px-4 rounded">
Expand All @@ -36,7 +36,7 @@ <h1 class="text-3xl font-bold text-gray-800">{{ job.title }}</h1>
<div class="p-6 grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h2 class="text-lg font-semibold text-gray-700">Job Field</h2>
<p class="text-gray-600">{{ job.jobField?.name || 'Unknown Field' }}</p>
<p class="text-gray-600">{{ job.jobField.name || 'Unknown Field' }}</p>
</div>
<div>
<h2 class="text-lg font-semibold text-gray-700">Job Type</h2>
Expand Down Expand Up @@ -69,7 +69,7 @@ <h2 class="text-2xl font-bold text-gray-800 mb-4">Job Description</h2>
<!-- About the Company -->
<div class="p-6">
<h2 class="text-2xl font-bold text-gray-800 mb-4">About the Company</h2>
<p class="text-gray-700">{{ job.company?.about || 'No information available.' }}</p>
<p class="text-gray-700">{{ job.company.about || 'No information available.' }}</p>
</div>

<!-- Additional Information -->
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/components/shared/jobs/jobs.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ <h2 class="text-2xl font-semibold text-gray-800 ml-28">Job Listings</h2>
<div class="flex items-center space-x-4">
<!-- Job Icon (Company Logo) -->
<div class="p-3 bg-red-100 rounded-full">
<img [src]="job.company?.logo || 'assets/home/default-logo.svg'" alt="{{ job.company?.name }}" class="h-12 w-12 object-cover rounded-full">
<img [src]="job.company.logo || 'assets/home/default-logo.svg'" alt="{{ job.company.name }}" class="h-12 w-12 object-cover rounded-full">
</div>

<!-- Job Details -->
<div>
<h3 class="text-xl font-semibold text-gray-800">{{ job.title }}</h3>
<div class="flex items-center space-x-4 text-gray-600 text-sm mt-2">
<span><i class="pi pi-briefcase"></i> {{ job.jobField?.name || 'Unknown Field' }}</span>
<span><i class="pi pi-briefcase"></i> {{ job.jobField.name || 'Unknown Field' }}</span>
<span *ngIf="job.salaryRange">{{ job.salaryRange }}</span>
<span><i class="pi pi-map-marker"></i> {{ job.company?.country || 'Unknown Location' }}</span>
<span><i class="pi pi-map-marker"></i> {{ job.company.country || 'Unknown Location' }}</span>
<span><i class="pi pi-clock"></i> {{ job.deadline | date:'shortDate' }}</span>
</div>
<!-- Job Type -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Application } from '../../interfaces/application';
providedIn: 'root'
})
export class ApplicationService {
private readonly API_URL = 'http://localhost:5000/api/applications';
private readonly API_URL = 'https://forjobseeker-rv9r.onrender.com/api/applications';
private tokenKey = 'auth-token';

constructor(private http: HttpClient) {}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/services/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { catchError, map, tap } from 'rxjs/operators';
providedIn: 'root'
})
export class AuthService {
private readonly API_URL = 'http://localhost:5000/api/auth';
private readonly API_URL = 'https://forjobseeker-rv9r.onrender.com/api/auth';
private tokenKey = 'auth-token';
private roleKey = 'user-role';
private companyIdKey = 'company-id';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { catchError, map } from 'rxjs/operators';
providedIn: 'root'
})
export class CertificationService {
private readonly API_URL = 'http://localhost:5000/api/certifications';
private readonly API_URL = 'https://forjobseeker-rv9r.onrender.com/api/certifications';
private tokenKey = 'auth-token';

constructor(private http: HttpClient) {}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/services/company/company.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Company, CompanyResponse } from '../../interfaces/company';
providedIn: 'root'
})
export class CompanyService {
private readonly API_URL = 'http://localhost:5000/api/companies';
private readonly API_URL = 'https://forjobseeker-rv9r.onrender.com/api/companies';
private tokenKey = 'auth-token';

constructor(private http: HttpClient) {}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/services/job/job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Job, JobResponse } from '../../interfaces/job';
providedIn: 'root'
})
export class JobService {
private readonly API_URL = 'http://localhost:5000/api/jobs';
private readonly API_URL = 'https://forjobseeker-rv9r.onrender.com/api/jobs';
private tokenKey = 'auth-token';

constructor(private http: HttpClient) {}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/services/jobfield/jobfield.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { JobField } from '../../interfaces/jobfield';
providedIn: 'root'
})
export class JobFieldService {
private readonly API_URL = 'http://localhost:5000/api/jobfields';
private readonly API_URL = 'https://forjobseeker-rv9r.onrender.com/jobfields';
private tokenKey = 'auth-token';

constructor(private http: HttpClient) {}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/services/jobseeker/jobseeker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { JobSeeker, JobSeekerResponse } from '../../interfaces/jobseeker';
providedIn: 'root'
})
export class JobSeekerService {
private readonly API_URL = 'http://localhost:5000/api/jobseekers';
private readonly API_URL = 'https://forjobseeker-rv9r.onrender.com/api/jobseekers';
private tokenKey = 'auth-token';

constructor(private http: HttpClient) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { catchError, map } from 'rxjs/operators';
providedIn: 'root'
})
export class WorkExperienceService {
private readonly API_URL = 'http://localhost:5000/api/workexperience';
private readonly API_URL = 'https://forjobseeker-rv9r.onrender.com/workexperience';
private tokenKey = 'auth-token';

constructor(private http: HttpClient) {}
Expand Down

0 comments on commit d3cd7d6

Please sign in to comment.