Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jmuzina committed Sep 21, 2023
2 parents 79f2dfe + 010b6e8 commit 10b4c6c
Show file tree
Hide file tree
Showing 47 changed files with 609 additions and 125 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "portfolio",
"version": "1.04",
"version": "1.05",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
5 changes: 0 additions & 5 deletions src/app/classes/Resume.ts

This file was deleted.

18 changes: 1 addition & 17 deletions src/app/classes/Skill.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
import { IPicture } from '../interfaces/Picture';

export interface ISkillOpts {
id: number;
label: string;
description?: string;
picture?: IPicture;
acquired_at: Date;
highlighted?: boolean;
classification?: ISkillClassificationOpts;
}

export interface ISkillClassificationOpts {
id: number;
label: string;
picture?: IPicture;
skills: ISkillOpts[];
}
import { ISkillClassificationOpts, ISkillOpts } from '../interfaces/employment/Skill';

export class SkillClassification implements ISkillClassificationOpts {
public id!: number;
Expand Down
102 changes: 102 additions & 0 deletions src/app/classes/education/Degree.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { IDegreeHonorOpts, IDegreeOpts, IDegreeTypeOpts } from 'src/app/interfaces/education/Degree';
import { EducationalInstitution } from './EducationalInstitution';
import { Major } from './Major';
import { IEducationalField } from 'src/app/interfaces/education/EducationalField';
import { EducationalLevel } from './EducationalLevel';

export class DegreeHonor implements IDegreeHonorOpts {
id!: number;

label!: string;

constructor(opts: IDegreeHonorOpts) {
Object.assign(this, opts);
}
}
export class DegreeType implements IDegreeTypeOpts {
id!: number;

prefix!: string;

usesSuffixInline!: boolean;

level!: EducationalLevel;

label!: string;

constructor(opts: IDegreeTypeOpts) {
Object.assign(this, opts);
}
}

export class Degree {
id!: number;

gpa?: number;

startedOn!: Date;

awardedOn?: Date;

institution!: EducationalInstitution;

major!: Major;

field!: IEducationalField;

type!: DegreeType;

honor?: DegreeHonor;

static Sort(a: Degree, b: Degree) {
const degreeTimestamps = {
a: {
start: a.startedOn.getTime(),
end: a.awardedOn?.getTime(),
},
b: {
start: b.startedOn.getTime(),
end: b.awardedOn?.getTime(),
},
};

if (degreeTimestamps.a.end === degreeTimestamps.b.end) {
// award dates are the same

// first try to differentiate by degree start dates.
// Whichever was started more recently should be first.
if (degreeTimestamps.a.start > degreeTimestamps.b.start) return -1;
if (degreeTimestamps.a.start < degreeTimestamps.b.start) return 1;

// award and start dates are identical, defer to educational level sort
const educationalLevelSortResult = EducationalLevel.Sort(a.type.level, b.type.level);
if (educationalLevelSortResult) return educationalLevelSortResult;

// Educational levels are also the same. Defer to educational institution sort.
return EducationalInstitution.Sort(a.institution, b.institution);
}

// award dates are different.
// if one of the degrees is still in progress it should come first.

if (!degreeTimestamps.a.end) return -1;
if (!degreeTimestamps.b.end) return 1;

// Both degrees are completed and were completed at different times.
// The one that was completed more recently should appear first.
if (degreeTimestamps.a.end > degreeTimestamps.b.end) return -1;
return 1;
}

constructor(opts: IDegreeOpts) {
this.id = opts.id;
this.gpa = opts.gpa;
this.startedOn = new Date(opts.startedOn);
this.awardedOn = opts.awardedOn ? new Date(opts.awardedOn) : undefined;
this.institution = opts.institution;
this.major = opts.major;
this.field = opts.field;
this.type = opts.type;
this.honor = opts.honor;
}
}
30 changes: 30 additions & 0 deletions src/app/classes/education/EducationalInstitution.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export interface IEducationalInstitutionType {
id: number;
label: string;
}

export interface IEducationalInstitution {
id: number;
name: string;
institutionType: IEducationalInstitutionType;
}

export class EducationalInstitution {
id!: number;

name!: string;

type!: IEducationalInstitutionType;

static Sort(a: EducationalInstitution, b: EducationalInstitution) {
if (a.name !== b.name) return a.name.localeCompare(b.name);
return a.type.label.localeCompare(b.type.label);
}

constructor(opts: IEducationalInstitution) {
this.id = opts.id;
this.name = opts.name;
this.type = opts.institutionType;
}

}
19 changes: 19 additions & 0 deletions src/app/classes/education/EducationalLevel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { IEducationalLevelOpts } from 'src/app/interfaces/education/EducationLevel';

export class EducationalLevel implements IEducationalLevelOpts {
id!: number;

label!: string;

priority!: number;

static Sort(a: EducationalLevel, b: EducationalLevel) {
if (a.priority < b.priority) return -1;
if (a.priority === b.priority) return a.label.localeCompare(b.label);
return 1;
}

constructor(opts: IEducationalLevelOpts) {
Object.assign(this, opts);
}
}
13 changes: 13 additions & 0 deletions src/app/classes/education/Major.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { IMajorOpts } from 'src/app/interfaces/education/Major';

export class Major implements IMajorOpts {
id!: number;

label!: string;

abbreviation!: string;

constructor(opts: IMajorOpts) {
Object.assign(this, opts);
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import { IEmployerOpts } from '../../interfaces/employment/Employer';
import { Job } from './Job';

export interface IEmployerOpts {
id: number;
name: string;
website?: string;
photoUrl?: string;
jobs: Job[];
}

export class Employer implements IEmployerOpts {
public id!: number;

Expand Down
17 changes: 3 additions & 14 deletions src/app/classes/Job.ts → src/app/classes/employment/Job.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { IResponsibilityOpts } from 'src/app/interfaces/employment/Responsibility';
import { Skill } from '../Skill';
import { Employer } from './Employer';
import { Skill } from './Skill';

export interface IResponsibilityOpts {
id: number;
text: string;
}
import { IJobOpts } from 'src/app/interfaces/employment/Job';

export class Responsibility implements IResponsibilityOpts {
public id!: number;
Expand All @@ -16,14 +13,6 @@ export class Responsibility implements IResponsibilityOpts {
}
}

export interface IJobOpts {
title: string;
started_at: Date;
ended_at?: Date;
employer: Employer;
skills: Skill[];
responsibilities: Responsibility[];
}

export class Job implements IJobOpts {
public title!: string;
Expand Down
63 changes: 63 additions & 0 deletions src/app/constants/graphql/educational-queries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
export const EDUCATION_QUERIES = {
GET_MAPPINGS: `
query getEducationalInfo {
degreeTypes: portfolio_zlookup_degree_type(where: {Degrees_aggregate: {count: {filter: {started_on: {_lte: "now()"}}, predicate: {_neq: 0}}}}) {
id
prefix
usesSuffixInline: uses_suffix_inline
education_level_fk
label
}
degreeHonors:portfolio_zlookup_degree_honors(where:{Degrees_aggregate:{count:{filter:{started_on:{_lte:"now()"}}, predicate:{_neq:0}}}}) {
id
label
}
educationLevels: portfolio_zlookup_education_level(where: {DegreeTypes_aggregate: {count: {filter: {Degrees_aggregate: {count: {filter: {started_on: {_lte: "now()"}}, predicate: {_neq: 0}}}}, predicate: {_neq: 0}}}}) {
id
label
priority
}
institutionTypes: portfolio_zlookup_education_institution_type(where: {EducationInstitutions_aggregate: {count: {filter: {Degrees_aggregate: {count: {filter: {started_on: {_lte: "now()"}}, predicate: {_neq: 0}}}}, predicate: {_neq: 0}}}}) {
id
label
}
majors: portfolio_zlookup_degree_major(where: {Degrees_aggregate: {count: {filter: {started_on: {_lte: "now()"}}, predicate: {_neq: 0}}}}) {
id
label
abbreviation
}
fields: portfolio_zlookup_degree_field(where: {Degrees_aggregate: {count: {filter: {started_on: {_lte: "now()"}}, predicate: {_neq: 0}}}}) {
id
suffix
label: field_label
}
institutions: portfolio_EducationInstitution(where: {Degrees_aggregate: {count: {filter: {started_on: {_lte: "now()"}}, predicate: {_neq: 0}}}}) {
id
name
type_id_fk: type_id
}
degrees: portfolio_Degree(where: {started_on: {_lte: "now()"}}) {
id
gpa
startedOn: started_on
awardedOn: awarded_on
institution_fk
major_fk
degree_field_fk
degree_type_fk
honor_fk
}
}
`,
GET_DEGREES: `query GetDegrees {
portfolio_Degree(order_by: {DegreeType: {EducationLevel: {priority: asc}}}) {
institution_fk
major_fk
degree_field_fk
degree_type_fk
gpa
awarded_on
started_on
}
}`,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface ColorTheme {
export interface IColorTheme {
code: string;
supportingCode: string;
label: string;
Expand Down
50 changes: 50 additions & 0 deletions src/app/interfaces/education/Degree.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { EducationalInstitution } from 'src/app/classes/education/EducationalInstitution';
import { Major } from 'src/app/classes/education/Major';
import { IEducationalField } from './EducationalField';
import { DegreeHonor, DegreeType } from 'src/app/classes/education/Degree';
import { EducationalLevel } from 'src/app/classes/education/EducationalLevel';

export interface IDegreeTypeOpts {
id: number;
prefix: string;
usesSuffixInline: boolean;
level: EducationalLevel;
label: string;
}

export interface IDegreeHonorOpts {
id: number;
label: string;
}

export interface IDegreeTypeQryOpts {
id: number;
prefix: string;
usesSuffixInline: boolean;
education_level_fk: number;
label: string;
}

export interface IDegreeQryOpts {
id: number;
gpa?: number;
startedOn: string;
awardedOn?: string;
institution_fk: number;
major_fk: number;
degree_field_fk: number;
degree_type_fk: number;
honor_fk?: number;
}

export interface IDegreeOpts {
id: number;
gpa?: number;
startedOn: string;
awardedOn?: string;
institution: EducationalInstitution;
major: Major;
field: IEducationalField;
type: DegreeType;
honor?: DegreeHonor;
}
5 changes: 5 additions & 0 deletions src/app/interfaces/education/EducationLevel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface IEducationalLevelOpts {
id: number;
label: string;
priority: number;
}
5 changes: 5 additions & 0 deletions src/app/interfaces/education/EducationalField.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface IEducationalField {
id: number;
label: string;
suffix: string;
}
Loading

0 comments on commit 10b4c6c

Please sign in to comment.