api-server-setup #1

Merged
derek merged 37 commits from api-server-setup into main 2025-07-15 21:17:25 -07:00
Showing only changes of commit 53877643f6 - Show all commits
@@ -0,0 +1,244 @@
using BoredCareers.Entities;
using System.Data;
using System.Data.Common;
namespace BoredCareers.Services.DatabaseService {
public partial class DatabaseService {
public async Task<Resume?> GetResume(DbDataReader reader) {
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _accountid = reader.GetInt32("AccountID");
string _name = reader.GetString("Name");
string _field = reader.GetString("Field");
string _email = reader.GetString("Email");
string _phonenumber = reader.GetString("PhoneNumber");
string _postalcode = reader.GetString("PostalCode");
string _country = reader.GetString("Country");
string _state = reader.GetString("StateOrRegion");
string _city = reader.GetString("City");
bool _isactive = reader.GetBoolean("IsActive");
return new Resume() {
ID = _id,
AccountID = _accountid,
Name = _name,
Field = _field,
Email = _email,
PhoneNumber = _phonenumber,
PostalCode = _postalcode,
Country = _country,
StateOrRegion = _state,
City = _city,
IsActive = _isactive
};
}
return null;
}
public async Task<ResumeExperienceBullet[]> GetResumeExperienceBullets(DbDataReader reader) {
List<ResumeExperienceBullet> experienceBullets = new List<ResumeExperienceBullet>();
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID");
int _experienceid = reader.GetInt32("ResumeExperienceID");
string _jobfunction = reader.GetString("JobFunction");
experienceBullets.Add(new ResumeExperienceBullet() {
ID = _id,
ResumeID = _resumeid,
ResumeExperienceID = _experienceid,
JobFunction = _jobfunction
});
}
return experienceBullets.ToArray();
}
public async Task<ResumeExperience[]> GetResumeExperience(DbDataReader reader) {
List<ResumeExperience> experience = new List<ResumeExperience>();
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID");
string _jobtitle = reader.GetString("JobTitle");
string _company = reader.GetString("Company");
string _postalcode = reader.GetString("PostalCode");
string _country = reader.GetString("Country");
string _state = reader.GetString("StateOrRegion");
string _city = reader.GetString("City");
DateTime _datestarted = reader.GetDateTime("DateStarted");
bool _stillempoyed = reader.GetBoolean("StillEmployed");
DateTime _dateended = reader.GetDateTime("DateEnded");
experience.Add(new ResumeExperience() {
ID = _id,
ResumeID = _resumeid,
JobTitle = _jobtitle,
Company = _company,
PostalCode = _postalcode,
Country = _country,
StateOrRegion = _state,
City = _city,
DateStarted = _datestarted,
StillEmployed = _stillempoyed,
DateEnded = _dateended,
});
}
return experience.ToArray();
}
public async Task<ResumeMilitaryBullet[]> GetResumeMilitaryBullets(DbDataReader reader) {
List<ResumeMilitaryBullet> militaryBullets = new List<ResumeMilitaryBullet>();
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID");
int _experienceid = reader.GetInt32("ResumeMilitaryID");
string _achievement = reader.GetString("Achevement");
string _description = reader.GetString("Description");
militaryBullets.Add(new ResumeMilitaryBullet() {
ID = _id,
ResumeID = _resumeid,
ResumeMilitaryID = _experienceid,
Achevement = _achievement,
Description = _description
});
}
return militaryBullets.ToArray();
}
public async Task<ResumeMilitary?> GetResumeMilitary(DbDataReader reader) {
ResumeMilitary? military = null;
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID");
string _country = reader.GetString("Country");
string _rank = reader.GetString("Rank");
DateTime _datestarted = reader.GetDateTime("DateStarted");
bool _stillServing = reader.GetBoolean("StillServing");
DateTime _dateended = reader.GetDateTime("DateEnded");
military = new ResumeMilitary() {
ID = _id,
ResumeID = _resumeid,
Country = _country,
Rank = _rank,
DateStarted = _datestarted,
StillServing = _stillServing,
DateEnded = _dateended,
};
}
return military;
}
public async Task<ResumeEducation[]> GetResumeEducation(DbDataReader reader) {
List<ResumeEducation>? education = new List<ResumeEducation>();
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID");
string _degreetype = reader.GetString("DegreeType");
string _degreefield = reader.GetString("DegreeField");
string _school = reader.GetString("School");
string _postalcode = reader.GetString("PostalCode");
string _country = reader.GetString("Country");
string _state = reader.GetString("StateOrRegion");
string _city = reader.GetString("City");
DateTime _datestarted = reader.GetDateTime("DateStarted");
bool _stillstudying = reader.GetBoolean("StillStudying");
DateTime _dateended = reader.GetDateTime("DateEnded");
education.Add(new ResumeEducation {
ID = _id,
ResumeID = _resumeid,
DegreeType = _degreetype,
DegreeField = _degreefield,
School = _school,
PostalCode = _postalcode,
Country = _country,
StateOrRegion = _state,
City = _city,
DateStarted = _datestarted,
StillStudying = _stillstudying,
DateEnded = _dateended
});
}
return education.ToArray();
}
public async Task<ResumeSkill[]> GetResumeSkills(DbDataReader reader) {
List<ResumeSkill> skills = new List<ResumeSkill>();
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID");
string _name = reader.GetString("Name");
string _description = reader.GetString("Description");
skills.Add( new ResumeSkill {
ID = _id,
ResumeID = _resumeid,
Name = _name,
Description = _description
} );
}
return skills.ToArray();
}
public async Task<ResumeLanguage[]> GetResumeLanguages(DbDataReader reader) {
List<ResumeLanguage>? languages = new List<ResumeLanguage>();
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID");
string _language = reader.GetString("Language");
string _proficiency = reader.GetString("Proficiency");
languages.Add( new ResumeLanguage {
ID = _id,
ResumeID = _resumeid,
Language = _language,
Proficiency = _proficiency
} );
}
return languages.ToArray();
}
public async Task<ResumeCertification[]> GetResumeCertification(DbDataReader reader) {
List<ResumeCertification> certs = new List<ResumeCertification>();
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID");
string _name = reader.GetString("Name");
string _url = reader.GetString("VerificationURL");
string _description = reader.GetString("Description");
certs.Add( new ResumeCertification {
ID = _id,
ResumeID = _resumeid,
Name = _name,
VerificationURL = _url,
Description = _description
} );
}
return certs.ToArray();
}
public async Task<ResumeProject[]> GetResumeProjects(DbDataReader reader) {
List<ResumeProject>? projects = new List<ResumeProject>();
while (await reader.ReadAsync()) {
if (reader == null) { break; }
int _id = reader.GetInt32("ID");
int _resumeid = reader.GetInt32("ResumeID");
string _name = reader.GetString("Name");
string _url = reader.GetString("URL");
string _description = reader.GetString("Description");
projects.Add( new ResumeProject {
ID = _id,
ResumeID = _resumeid,
Name = _name,
URL = _url,
Description = _description
} );
}
return projects.ToArray();
}
}
}