Remove Veteran, Allow Millitary to be NULL

This commit is contained in:
2025-08-13 06:28:14 -07:00
parent 7f7d5f587d
commit 369d71d446
6 changed files with 24 additions and 16 deletions
-1
View File
@@ -48,7 +48,6 @@ CREATE TABLE IF NOT EXISTS `Resume` (
CREATE TABLE IF NOT EXISTS `ResumeMilitary` ( CREATE TABLE IF NOT EXISTS `ResumeMilitary` (
`ID` int NOT NULL AUTO_INCREMENT, `ID` int NOT NULL AUTO_INCREMENT,
`ResumeID` int NOT NULL, `ResumeID` int NOT NULL,
`Veteran` boolean DEFAULT 0,
`Country` char(2) NOT NULL, `Country` char(2) NOT NULL,
`Rank` varchar(50) NOT NULL, `Rank` varchar(50) NOT NULL,
`DateStarted` date NOT NULL, `DateStarted` date NOT NULL,
+1 -2
View File
@@ -14,7 +14,7 @@ export class Resume {
public city: string = ""; public city: string = "";
public isActive: boolean = false; public isActive: boolean = false;
public experience: ResumeExperience[] = []; public experience: ResumeExperience[] = [];
public military: ResumeMilitary = new ResumeMilitary; public military: ResumeMilitary | null = new ResumeMilitary;
public education: ResumeEducation[] = []; public education: ResumeEducation[] = [];
public skills: ResumeSkill[] = []; public skills: ResumeSkill[] = [];
public languages: ResumeLanguage[] = []; public languages: ResumeLanguage[] = [];
@@ -53,7 +53,6 @@ export class ResumeMilitary {
public id: number | null = null; public id: number | null = null;
public resumeID: number | null = null; public resumeID: number | null = null;
public veteran: boolean = false;
public country: string = ""; public country: string = "";
public rank: string = ""; public rank: string = "";
public dateStarted: Date = new Date(); public dateStarted: Date = new Date();
@@ -43,8 +43,8 @@
<!-- Military --> <!-- Military -->
<div class="resume-section"> <div class="resume-section">
<h1>Is Veteran: </h1><input name="veteran" [(ngModel)]="resume.military.veteran" type="checkbox" /> <h1>Is Veteran: </h1><input name="veteran" type="checkbox" (change)="onVeteranChange($event)" />
@if(resume.military.veteran){ @if(resume.military !== null){
<input name="militarycountry" [(ngModel)]="resume.military.country" type="text" placeholder="US" /> <input name="militarycountry" [(ngModel)]="resume.military.country" type="text" placeholder="US" />
<input name="militaryrank" [(ngModel)]="resume.military.rank" type="text" placeholder="PVT" /> <input name="militaryrank" [(ngModel)]="resume.military.rank" type="text" placeholder="PVT" />
<input name="militarydateStarted" [(ngModel)]="resume.military.dateStarted" type="date" /> <input name="militarydateStarted" [(ngModel)]="resume.military.dateStarted" type="date" />
@@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
import { Router, ActivatedRoute, RouterModule } from '@angular/router'; import { Router, ActivatedRoute, RouterModule } from '@angular/router';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Resume, ResumeCertification, ResumeEducation, ResumeExperience, ResumeExperienceBullet, ResumeLanguage, ResumeMilitaryBullet, ResumeProject, ResumeSkill } from 'app/models/Resume'; import { Resume, ResumeCertification, ResumeEducation, ResumeExperience, ResumeExperienceBullet, ResumeLanguage, ResumeMilitary, ResumeMilitaryBullet, ResumeProject, ResumeSkill } from 'app/models/Resume';
import { Authentication } from 'app/services/Authentication'; import { Authentication } from 'app/services/Authentication';
import { HomeComponent } from "app/pages/home/home.component"; import { HomeComponent } from "app/pages/home/home.component";
@@ -33,6 +33,7 @@ export class ResumesEditorComponent {
this.http.get<Resume>("api/resume?ResumeID=" + ResumeID).subscribe({ this.http.get<Resume>("api/resume?ResumeID=" + ResumeID).subscribe({
next: data => { next: data => {
this.resume = data; this.resume = data;
this.milCache = data.military;
this.isNewResume = false; this.isNewResume = false;
}, },
error: err => { error: err => {
@@ -81,10 +82,21 @@ export class ResumesEditorComponent {
} }
} }
milCache: ResumeMilitary | null = new ResumeMilitary;
onVeteranChange(event: Event){
const checkbox = event.target as HTMLInputElement;
const isChecked = checkbox.checked;
if (isChecked){
this.resume.military = this.milCache;
} else {
this.resume.military = null;
}
}
addMillitaryBullet(){ addMillitaryBullet(){
this.resume.military.millitaryBullets.push( new ResumeMilitaryBullet ); this.resume.military?.millitaryBullets.push( new ResumeMilitaryBullet );
} }
delMillitaryBullet(self: ResumeMilitaryBullet){ delMillitaryBullet(self: ResumeMilitaryBullet){
if (this.resume.military !== null){
for(let i=0; i<this.resume.military.millitaryBullets.length; i++){ for(let i=0; i<this.resume.military.millitaryBullets.length; i++){
let cur = this.resume.military.millitaryBullets[i]; let cur = this.resume.military.millitaryBullets[i];
if (cur.trackUUID === self.trackUUID){ if (cur.trackUUID === self.trackUUID){
@@ -93,6 +105,7 @@ export class ResumesEditorComponent {
} }
} }
} }
}
addEducation(){ addEducation(){
this.resume.education.push( new ResumeEducation ); this.resume.education.push( new ResumeEducation );
+1 -2
View File
@@ -13,7 +13,7 @@ namespace BoredCareers.Entities {
public string City { get; set; } = ""; public string City { get; set; } = "";
public bool IsActive { get; set; } = false; public bool IsActive { get; set; } = false;
public ResumeExperience[] Experience { get; set; } = []; public ResumeExperience[] Experience { get; set; } = [];
public ResumeMilitary Millitary { get; set; } = new ResumeMilitary(); public ResumeMilitary? Millitary { get; set; } = null;
public ResumeEducation[] Educations { get; set; } = []; public ResumeEducation[] Educations { get; set; } = [];
public ResumeSkill[] Skills { get; set; } = []; public ResumeSkill[] Skills { get; set; } = [];
public ResumeLanguage[] Languages { get; set; } = []; public ResumeLanguage[] Languages { get; set; } = [];
@@ -46,7 +46,6 @@ namespace BoredCareers.Entities {
public class ResumeMilitary { public class ResumeMilitary {
public int? ID { get; set; } // PK public int? ID { get; set; } // PK
public int ResumeID { get; set; } // FK public int ResumeID { get; set; } // FK
public bool Veteran { get; set; } = false;
public string Country { get; set; } = ""; // 2 Letter Country Code public string Country { get; set; } = ""; // 2 Letter Country Code
public string Rank { get; set; } = ""; public string Rank { get; set; } = "";
public DateTime DateStarted { get; set; } = new DateTime(); public DateTime DateStarted { get; set; } = new DateTime();
@@ -114,7 +114,6 @@ namespace BoredCareers.Services.DatabaseService {
if (reader == null) { break; } if (reader == null) { break; }
int _id = reader.GetInt32("ID"); int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID"); int _resumeid = reader.GetInt32("ResumeID");
bool _veteran = reader.GetBoolean("Veteran");
string _country = reader.GetString("Country"); string _country = reader.GetString("Country");
string _rank = reader.GetString("Rank"); string _rank = reader.GetString("Rank");
DateTime _datestarted = reader.GetDateTime("DateStarted"); DateTime _datestarted = reader.GetDateTime("DateStarted");
@@ -123,7 +122,6 @@ namespace BoredCareers.Services.DatabaseService {
military = new ResumeMilitary() { military = new ResumeMilitary() {
ID = _id, ID = _id,
ResumeID = _resumeid, ResumeID = _resumeid,
Veteran = _veteran,
Country = _country, Country = _country,
Rank = _rank, Rank = _rank,
DateStarted = _datestarted, DateStarted = _datestarted,