Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Prepare mock data

Khuram Niaza60fb49b0cc1
diff --git a/src/lib/data/myJobsData.ts b/src/lib/data/myJobsData.ts
index 232a01d..6c122ae 100644
--- a/src/lib/data/myJobsData.ts
+++ b/src/lib/data/myJobsData.ts
@@ -1,114 +1,278 @@
-export interface MyJobs {
- id: number;
- company: string;
- companyLogo: string;
- jobTitle: string;
- location: string;
- status: string;
- jobSource: string;
- dateApplied: string;
-}
-export const MY_JOBS_DATA: { data: MyJobs[] } = {
+import { JobResponse } from "@/models/job.model";
+
+export const MY_JOBS_DATA: { data: JobResponse[]; total: number } = {
+ total: 10,
data: [
{
- id: 1,
- company: "Microsoft",
- companyLogo: "/icons/microsoft-logo.svg",
- jobTitle: "Full Stack Developer",
- location: "Remote",
- status: "Applied",
- jobSource: "Indeed",
- dateApplied: "2024-04-19",
+ id: "2",
+ userId: "xyz",
+ Company: {
+ id: "2",
+ label: "Amazon",
+ value: "amazon",
+ createdBy: "xyz",
+ logoUrl: "/icons/amazon-logo.svg",
+ },
+ JobTitle: {
+ id: "1",
+ label: "Full Stack Developer",
+ value: "full stack developer",
+ createdBy: "xyz",
+ },
+ jobType: "FT",
+ jobUrl: "",
+ applied: true,
+ Location: { id: "1", label: "Remote", value: "remote", createdBy: "xyz" },
+ Status: { id: "1", label: "Draft", value: "draft" },
+ JobSource: { id: "1", label: "Indeed", value: "indeed" },
+ appliedDate: new Date("2024-06-19"),
+ description:
+ "<p>We are looking for a <strong>Full Stack Developer</strong> to join our team at Amazon. You will be responsible for developing and maintaining our web applications. Strong experience in both front-end and back-end technologies is required.</p>",
+ salaryRange: "$100,000 - $120,000",
+ dueDate: new Date("2024-06-22"),
+ createdAt: new Date("2024-06-17"),
},
{
- id: 2,
- company: "Amazon",
- companyLogo: "/icons/amazon-logo.svg",
- jobTitle: "Full Stack Developer",
- location: "Remote",
- status: "Applied",
- jobSource: "Indeed",
- dateApplied: "2024-04-19",
+ id: "3",
+ userId: "xyz",
+ Company: {
+ id: "3",
+ label: "Google",
+ value: "google",
+ createdBy: "xyz",
+ logoUrl: "/icons/google-logo.svg",
+ },
+ JobTitle: {
+ id: "1",
+ label: "Full Stack Developer",
+ value: "full stack developer",
+ createdBy: "xyz",
+ },
+ jobType: "FT",
+ jobUrl: "",
+ applied: true,
+ Location: { id: "1", label: "Remote", value: "remote", createdBy: "xyz" },
+ Status: { id: "1", label: "Rejected", value: "rejected" },
+ JobSource: { id: "1", label: "Indeed", value: "indeed" },
+ appliedDate: new Date("2024-06-20"),
+ description:
+ "<p>Join our dynamic team at Google as a <strong>Full Stack Developer</strong>. You will be involved in the full software development lifecycle, from conception to deployment. Proficiency in JavaScript, Python, and cloud technologies is required.</p>",
+ salaryRange: "$110,000 - $130,000",
+ dueDate: new Date("2024-06-22"),
+ createdAt: new Date("2024-06-17"),
},
{
- id: 3,
- company: "Google",
- companyLogo: "/icons/google-logo.svg",
- jobTitle: "Full Stack Developer",
- location: "Remote",
- status: "Applied",
- jobSource: "Indeed",
- dateApplied: "2024-04-19",
+ id: "4",
+ userId: "xyz",
+ Company: {
+ id: "4",
+ label: "Facebook",
+ value: "facebook",
+ createdBy: "xyz",
+ logoUrl: "/icons/facebook-logo.svg",
+ },
+ JobTitle: {
+ id: "1",
+ label: "Full Stack Developer",
+ value: "full stack developer",
+ createdBy: "xyz",
+ },
+ jobType: "FT",
+ jobUrl: "",
+ applied: true,
+ Location: { id: "1", label: "Remote", value: "remote", createdBy: "xyz" },
+ Status: { id: "1", label: "Applied", value: "applied" },
+ JobSource: { id: "1", label: "Indeed", value: "indeed" },
+ appliedDate: new Date("2024-06-19"),
+ description:
+ "<p>Facebook is seeking a talented <strong>Full Stack Developer</strong> to work on our cutting-edge social media platforms. Experience with React and Node.js is highly desirable. Work remotely with a team of top developers.</p>",
+ salaryRange: "$105,000 - $125,000",
+ dueDate: new Date("2024-06-22"),
+ createdAt: new Date("2024-06-17"),
},
{
- id: 4,
- company: "Facebook",
- companyLogo: "/icons/facebook-logo.svg",
- jobTitle: "Full Stack Developer",
- location: "Remote",
- status: "Applied",
- jobSource: "Indeed",
- dateApplied: "2024-04-19",
+ id: "5",
+ userId: "xyz",
+ Company: {
+ id: "5",
+ label: "Netflix",
+ value: "netflix",
+ createdBy: "xyz",
+ logoUrl: "/icons/netflix-logo.svg",
+ },
+ JobTitle: {
+ id: "1",
+ label: "Full Stack Developer",
+ value: "full stack developer",
+ createdBy: "xyz",
+ },
+ jobType: "FT",
+ jobUrl: "",
+ applied: true,
+ Location: { id: "1", label: "Remote", value: "remote", createdBy: "xyz" },
+ Status: { id: "1", label: "Applied", value: "applied" },
+ JobSource: { id: "2", label: "Linkedin", value: "linkedin" },
+ appliedDate: new Date("2024-06-18"),
+ description:
+ "<p>Netflix is hiring a <strong>Full Stack Developer</strong> to enhance our streaming platform. You will work on both front-end and back-end features, ensuring a seamless user experience. Familiarity with cloud infrastructure is a plus.</p>",
+ salaryRange: "$115,000 - $135,000",
+ dueDate: new Date("2024-06-22"),
+ createdAt: new Date("2024-06-17"),
},
{
- id: 5,
- company: "Netflix",
- companyLogo: "/icons/netflix-logo.svg",
- jobTitle: "Full Stack Developer",
- location: "Remote",
- status: "Applied",
- jobSource: "Linkedin",
- dateApplied: "2024-04-19",
+ id: "6",
+ userId: "xyz",
+ Company: {
+ id: "6",
+ label: "Apple",
+ value: "apple",
+ createdBy: "xyz",
+ logoUrl: "/icons/apple-logo.svg",
+ },
+ JobTitle: {
+ id: "2",
+ label: "Frontend Developer",
+ value: "frontend developer",
+ createdBy: "xyz",
+ },
+ jobType: "FT",
+ jobUrl: "",
+ applied: true,
+ Location: {
+ id: "2",
+ label: "San Francisco",
+ value: "san francisco",
+ createdBy: "xyz",
+ },
+ Status: { id: "1", label: "Applied", value: "applied" },
+ JobSource: { id: "1", label: "Indeed", value: "indeed" },
+ appliedDate: new Date("2024-06-18"),
+ description:
+ "<p>We are looking for a creative <strong>Frontend Developer</strong> at Apple to build intuitive interfaces for our products. Strong knowledge of HTML, CSS, and JavaScript is essential. Experience with design tools is a plus.</p>",
+ salaryRange: "$95,000 - $115,000",
+ dueDate: new Date("2024-06-22"),
+ createdAt: new Date("2024-06-17"),
},
{
- id: 6,
- company: "Apple",
- companyLogo: "/icons/apple-logo.svg",
- jobTitle: "Frontend Developer",
- location: "San Francisco",
- status: "Applied",
- jobSource: "Indeed",
- dateApplied: "2024-04-19",
+ id: "7",
+ userId: "xyz",
+ Company: {
+ id: "2",
+ label: "Amazon",
+ value: "amazon",
+ createdBy: "xyz",
+ logoUrl: "/icons/amazon-logo.svg",
+ },
+ JobTitle: {
+ id: "3",
+ label: "DevOps Engineer",
+ value: "devops engineer",
+ createdBy: "xyz",
+ },
+ jobType: "FT",
+ jobUrl: "",
+ applied: true,
+ Location: { id: "1", label: "Remote", value: "remote", createdBy: "xyz" },
+ Status: { id: "1", label: "Applied", value: "applied" },
+ JobSource: { id: "1", label: "Indeed", value: "indeed" },
+ appliedDate: new Date("2024-06-19"),
+ description:
+ "<p>Amazon is seeking a skilled <strong>DevOps Engineer</strong> to manage our deployment pipelines and infrastructure. Experience with AWS, Docker, and CI/CD tools is required. Join a fast-paced environment and help us scale.</p>",
+ salaryRange: "$120,000 - $140,000",
+ dueDate: new Date("2024-06-22"),
+ createdAt: new Date("2024-06-17"),
},
{
- id: 7,
- company: "Amazon",
- companyLogo: "/icons/amazon-logo.svg",
- jobTitle: "DevOps Engineer",
- location: "Remote",
- status: "Applied",
- jobSource: "Indeed",
- dateApplied: "2024-04-19",
+ id: "8",
+ userId: "xyz",
+ Company: {
+ id: "7",
+ label: "Microsoft",
+ value: "microsoft",
+ createdBy: "xyz",
+ logoUrl: "/icons/microsoft-logo.svg",
+ },
+ JobTitle: {
+ id: "4",
+ label: "Software Architect",
+ value: "software architect",
+ createdBy: "xyz",
+ },
+ jobType: "FT",
+ jobUrl: "",
+ applied: true,
+ Location: { id: "1", label: "Remote", value: "remote", createdBy: "xyz" },
+ Status: { id: "1", label: "Applied", value: "applied" },
+ JobSource: { id: "1", label: "Indeed", value: "indeed" },
+ appliedDate: new Date("2024-06-19"),
+ description:
+ "<p>We are looking for an experienced <strong>Software Architect</strong> at Microsoft to design and oversee the development of complex software systems. Strong leadership and coding skills are essential. Work with the latest technologies and shape the future of our products.</p>",
+ salaryRange: "$130,000 - $150,000",
+ dueDate: new Date("2024-06-22"),
+ createdAt: new Date("2024-06-17"),
},
{
- id: 8,
- company: "Microsoft",
- companyLogo: "/icons/microsoft-logo.svg",
- jobTitle: "Software Architect",
- location: "Remote",
- status: "Applied",
- jobSource: "Indeed",
- dateApplied: "2024-04-19",
+ id: "9",
+ userId: "xyz",
+ Company: {
+ id: "5",
+ label: "Netflix",
+ value: "netflix",
+ createdBy: "xyz",
+ logoUrl: "/icons/netflix-logo.svg",
+ },
+ JobTitle: {
+ id: "2",
+ label: "Frontend Developer",
+ value: "frontend developer",
+ createdBy: "xyz",
+ },
+ jobType: "FT",
+ jobUrl: "",
+ applied: true,
+ Location: {
+ id: "3",
+ label: "Los Angeles",
+ value: "los angeles",
+ createdBy: "xyz",
+ },
+ Status: { id: "1", label: "Applied", value: "applied" },
+ JobSource: { id: "1", label: "Indeed", value: "indeed" },
+ appliedDate: new Date("2024-06-19"),
+ description:
+ "<p>Netflix is seeking a talented <strong>Frontend Developer</strong> to join our team in Los Angeles. You will work on building responsive and interactive web applications. Experience with React and performance optimization is desired.</p>",
+ salaryRange: "$105,000 - $125,000",
+ dueDate: new Date("2024-06-22"),
+ createdAt: new Date("2024-06-17"),
},
{
- id: 9,
- company: "Netflix",
- companyLogo: "/icons/netflix-logo.svg",
- jobTitle: "Frontend Developer",
- location: "Los Angeles",
- status: "Applied",
- jobSource: "Indeed",
- dateApplied: "2024-04-19",
- },
- {
- id: 10,
- company: "Apple",
- companyLogo: "/icons/apple-logo.svg",
- jobTitle: "Backend Developer",
- location: "Remote",
- status: "Applied",
- jobSource: "Linkedin",
- dateApplied: "2024-04-19",
+ id: "10",
+ userId: "xyz",
+ Company: {
+ id: "6",
+ label: "Apple",
+ value: "apple",
+ createdBy: "xyz",
+ logoUrl: "/icons/apple-logo.svg",
+ },
+ JobTitle: {
+ id: "5",
+ label: "Backend Developer",
+ value: "backend developer",
+ createdBy: "xyz",
+ },
+ jobType: "FT",
+ jobUrl: "",
+ applied: true,
+ Location: { id: "1", label: "Remote", value: "remote", createdBy: "xyz" },
+ Status: { id: "1", label: "Applied", value: "applied" },
+ JobSource: { id: "2", label: "Linkedin", value: "linkedin" },
+ appliedDate: new Date("2024-06-19"),
+ description:
+ "<p>Apple is hiring a <strong>Backend Developer</strong> to build and maintain our server-side applications. Expertise in server-side programming languages and database management is required. Work remotely and collaborate with our global team.</p>",
+ salaryRange: "$115,000 - $135,000",
+ dueDate: new Date("2024-06-22"),
+ createdAt: new Date("2024-06-17"),
},
],
};
diff --git a/src/lib/mock.utils.ts b/src/lib/mock.utils.ts
new file mode 100644
index 0000000..5ee6088
--- /dev/null
+++ b/src/lib/mock.utils.ts
@@ -0,0 +1,158 @@
+import {
+ Company,
+ JobLocation,
+ JobTitle,
+ JobResponse,
+} from "@/models/job.model";
+import { MY_JOBS_DATA } from "./data/myJobsData";
+import { addDays, format, subDays } from "date-fns";
+
+export function getMockJobsList(
+ page: number,
+ jobsPerPage: number,
+ filter?: string
+): Promise<{ data: JobResponse[]; total: number }> {
+ return new Promise((resolve) => {
+ // Filter data by status
+ const filteredData = filter
+ ? MY_JOBS_DATA.data.filter((job) => job.Status.value === filter)
+ : MY_JOBS_DATA.data;
+
+ // Calculate start and end index for pagination
+ const startIndex = (page - 1) * jobsPerPage;
+ const endIndex = startIndex + jobsPerPage;
+
+ // Slice the data for the current page
+ const paginatedData = filteredData.slice(startIndex, endIndex);
+
+ resolve({ data: paginatedData, total: paginatedData.length });
+ });
+}
+
+export function getMockJobDetails(id: string): Promise<any> {
+ return new Promise((resolve) => {
+ // Find the job with the given id
+ const job = MY_JOBS_DATA.data.find((job) => job.id === id);
+
+ resolve(job);
+ });
+}
+
+/**
+ * Generates a random integer between the specified min and max values (inclusive).
+ *
+ * @param min - The minimum value.
+ * @param max - The maximum value.
+ * @returns A random integer between min and max.
+ */
+export const getRandomInt = (min: number, max: number): number => {
+ return Math.floor(Math.random() * (max - min + 1)) + min;
+};
+
+/**
+ * Generates an array of objects, each with a 'day' in 'yyyy-MM-dd' format and a 'value'
+ * that is a random number between 1 and 20. Randomly skips days based on the given probability.
+ *
+ * @param daysAgo - The number of day ago to start with.
+ * @param skipProbability - The probability of skipping a day (default is 0.3).
+ * @param formatType - Formats the date type (default is "yyyy-MM-dd")
+ * @returns An array of objects with 'day' and 'value' properties.
+ *
+ * @example
+ * // Example usage:
+ * const daysAgo = 30 // for 30 days from current date
+ * const randomDateValues = generateRandomDateValues(daysAgo);
+ * console.log(randomDateValues);
+ * FormatType: "yyyy-MM-dd" = "2024-06-23", "PP" = "Jun 23, 2024"
+ */
+export const getMockJobActivityData = (
+ daysAgo: number,
+ skipProbability: number = 0.3,
+ formatType: string = "yyyy-MM-dd"
+): Promise<{ day: string; value: number }[]> => {
+ return new Promise((resolve) => {
+ const result: { day: string; value: number }[] = [];
+ const endDate = new Date();
+ const startDate = subDays(new Date(), daysAgo);
+ let currentDate = startDate;
+
+ while (currentDate <= endDate) {
+ // Randomly decide whether to include the current date
+ if (Math.random() > skipProbability) {
+ const formattedDate = format(currentDate, formatType);
+ const randomValue = getRandomInt(1, 20);
+ result.push({ day: formattedDate, value: randomValue });
+ }
+ currentDate = addDays(currentDate, 1);
+ }
+
+ resolve(result);
+ });
+};
+
+export const getMockRecentJobs = (): Promise<JobResponse[]> => {
+ return new Promise((resolve) => {
+ const data = MY_JOBS_DATA.data.slice(0, 6);
+ resolve(data);
+ });
+};
+
+export function getMockList(
+ page = 1,
+ recordsPerPage = 10,
+ type: "companies" | "jobTitles" | "locations"
+): Promise<{ data: any[]; total: number }> {
+ return new Promise((resolve) => {
+ const result: { [key: string]: any } = {};
+
+ MY_JOBS_DATA.data.forEach((job) => {
+ let key: string,
+ label: string,
+ value: string,
+ createdBy: string,
+ logoUrl: string | undefined;
+
+ if (type === "companies") {
+ key = job.Company.id;
+ label = job.Company.label;
+ value = job.Company.value;
+ createdBy = job.Company.createdBy;
+ logoUrl = job.Company.logoUrl;
+ } else if (type === "jobTitles") {
+ key = job.JobTitle.id;
+ label = job.JobTitle.label;
+ value = job.JobTitle.value;
+ createdBy = job.Company.createdBy;
+ } else if (type === "locations") {
+ key = job.Location.id;
+ label = job.Location.label;
+ value = job.Location.value;
+ createdBy = job.Company.createdBy;
+ } else {
+ return;
+ }
+
+ if (!result[key]) {
+ result[key] = {
+ id: key,
+ label,
+ value,
+ createdBy,
+ logoUrl,
+ _count: type === "jobTitles" ? { jobs: 0 } : { jobsApplied: 0 },
+ };
+ }
+
+ if (job.applied) {
+ if (type === "jobTitles") {
+ result[key]._count!.jobs += 1;
+ } else {
+ result[key]._count!.jobsApplied += 1;
+ }
+ }
+ });
+ const data = Object.values(result);
+
+ resolve({ data, total: data.length });
+ });
+}
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 9e0f156..c5bee11 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -1,5 +1,4 @@
import { type ClassValue, clsx } from "clsx";
-import { addDays, format, subDays } from "date-fns";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
@@ -34,53 +33,3 @@ export function formatUrl(url: string) {
}
return url;
}
-
-/**
- * Generates a random integer between the specified min and max values (inclusive).
- *
- * @param min - The minimum value.
- * @param max - The maximum value.
- * @returns A random integer between min and max.
- */
-const getRandomInt = (min: number, max: number): number => {
- return Math.floor(Math.random() * (max - min + 1)) + min;
-};
-
-/**
- * Generates an array of objects, each with a 'day' in 'yyyy-MM-dd' format and a 'value'
- * that is a random number between 1 and 20. Randomly skips days based on the given probability.
- *
- * @param daysAgo - The number of day ago to start with.
- * @param skipProbability - The probability of skipping a day (default is 0.3).
- * @param formatType - Formats the date type (default is "yyyy-MM-dd")
- * @returns An array of objects with 'day' and 'value' properties.
- *
- * @example
- * // Example usage:
- * const daysAgo = 30 // for 30 days from current date
- * const randomDateValues = generateRandomDateValues(daysAgo);
- * console.log(randomDateValues);
- * FormatType: "yyyy-MM-dd" = "2024-06-23", "PP" = "Jun 23, 2024"
- */
-export const generateRandomActivityCalendarData = (
- daysAgo: number,
- skipProbability: number = 0.3,
- formatType: string = "yyyy-MM-dd"
-): { day: string; value: number }[] => {
- const result: { day: string; value: number }[] = [];
- const endDate = new Date();
- const startDate = subDays(new Date(), daysAgo);
- let currentDate = startDate;
-
- while (currentDate <= endDate) {
- // Randomly decide whether to include the current date
- if (Math.random() > skipProbability) {
- const formattedDate = format(currentDate, formatType);
- const randomValue = getRandomInt(1, 20);
- result.push({ day: formattedDate, value: randomValue });
- }
- currentDate = addDays(currentDate, 1);
- }
-
- return result;
-};