working #24
@@ -19,6 +19,7 @@ Server:
|
|||||||
|
|
||||||
CompanyEmailVerify:
|
CompanyEmailVerify:
|
||||||
Need to update notification email
|
Need to update notification email
|
||||||
|
Create page to notify cx that their work email has been verified
|
||||||
|
|
||||||
Client:
|
Client:
|
||||||
jobs/editor:
|
jobs/editor:
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ CREATE TABLE IF NOT EXISTS `Company` (
|
|||||||
CREATE TABLE IF NOT EXISTS `Employee` (
|
CREATE TABLE IF NOT EXISTS `Employee` (
|
||||||
`ID` int NOT NULL AUTO_INCREMENT,
|
`ID` int NOT NULL AUTO_INCREMENT,
|
||||||
`AccountID` int NOT NULL,
|
`AccountID` int NOT NULL,
|
||||||
|
`AccountName` varchar(60) NOT NULL,
|
||||||
|
`AccountEmail` varchar(255) NOT NULL,
|
||||||
`CompanyID` int NOT NULL,
|
`CompanyID` int NOT NULL,
|
||||||
PRIMARY KEY (`ID`),
|
PRIMARY KEY (`ID`),
|
||||||
FOREIGN KEY (`CompanyID`) REFERENCES `Company`(`ID`) ON DELETE CASCADE
|
FOREIGN KEY (`CompanyID`) REFERENCES `Company`(`ID`) ON DELETE CASCADE
|
||||||
|
|||||||
@@ -13,10 +13,4 @@ export class Company {
|
|||||||
public stateOrRegion: string = "";
|
public stateOrRegion: string = "";
|
||||||
public city: string = "";
|
public city: string = "";
|
||||||
public description: string = "";
|
public description: string = "";
|
||||||
}
|
|
||||||
|
|
||||||
export class Employee {
|
|
||||||
public id: number | null = null;
|
|
||||||
public accountID: number = 0;
|
|
||||||
public company: Company = new Company;
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { Company } from "./Company";
|
||||||
|
|
||||||
|
export class Employee {
|
||||||
|
public id: number | null = null;
|
||||||
|
public accountID: number = 0;
|
||||||
|
public accountName: string = "";
|
||||||
|
public accountEmail: string = "";
|
||||||
|
public company: Company = new Company;
|
||||||
|
}
|
||||||
@@ -43,7 +43,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="half-frame">
|
<div class="half-frame">
|
||||||
<h2>Employees</h2>
|
<h2>Employees</h2>
|
||||||
|
@for (listing of CompEmployees; track listing.id) {
|
||||||
|
<div class="job-tile">
|
||||||
|
<div class="center-text">
|
||||||
|
<h1>{{ listing.accountName }}</h1>
|
||||||
|
</div>
|
||||||
|
<button [routerLink]="['/']" [queryParams]="{ JobID: listing.id }" >REMOVE</button>
|
||||||
|
<button (click)="RemoveJobListing(listing.id!)">DELETE LISTING</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ 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 { Authentication } from 'app/services/Authentication';
|
import { Authentication } from 'app/services/Authentication';
|
||||||
import { Company, Employee } from 'app/models/Company';
|
import { Company } from 'app/models/Company';
|
||||||
import { JobListing } from 'app/models/JobListing';
|
import { JobListing } from 'app/models/JobListing';
|
||||||
|
import { Employee } from 'app/models/Employee';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'main-company',
|
selector: 'main-company',
|
||||||
@@ -20,6 +21,7 @@ export class CompanyComponent {
|
|||||||
public Employers: Employee[] = [];
|
public Employers: Employee[] = [];
|
||||||
|
|
||||||
public Comp: Company | null = null;
|
public Comp: Company | null = null;
|
||||||
|
public CompEmployees: Employee[] = [];
|
||||||
public Desc: string[] = [];
|
public Desc: string[] = [];
|
||||||
|
|
||||||
public List: JobListing[] = [];
|
public List: JobListing[] = [];
|
||||||
@@ -39,7 +41,6 @@ export class CompanyComponent {
|
|||||||
this.ErrorMsg = err.error;
|
this.ErrorMsg = err.error;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
changeSelectedCompany(companyID: number){
|
changeSelectedCompany(companyID: number){
|
||||||
@@ -61,6 +62,15 @@ export class CompanyComponent {
|
|||||||
this.ErrorMsg = err.error;
|
this.ErrorMsg = err.error;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.http.get<Employee[]>("api/employee/" + companyID).subscribe({
|
||||||
|
next: data => {
|
||||||
|
this.CompEmployees = data;
|
||||||
|
},
|
||||||
|
error: err => {
|
||||||
|
this.ErrorMsg = err.error;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveJobListing( JobListingID: number ){
|
RemoveJobListing( JobListingID: number ){
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { Title } from '@angular/platform-browser';
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { JobListing } from 'app/models/JobListing';
|
import { JobListing } from 'app/models/JobListing';
|
||||||
import { Authentication } from 'app/services/Authentication';
|
import { Authentication } from 'app/services/Authentication';
|
||||||
import { Company, Employee } from 'app/models/Company';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'main-jobs-editor',
|
selector: 'main-jobs-editor',
|
||||||
@@ -85,35 +84,20 @@ export class JobEditorComponent {
|
|||||||
this.updateUI();
|
this.updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
PostNewJob(jobListing: JobListing){
|
SubmitForm(jobListing: JobListing){
|
||||||
jobListing.companyID = this.modeID;
|
|
||||||
this.http.post("api/joblisting", jobListing).subscribe({
|
|
||||||
next: data => {
|
|
||||||
this.router.navigate([""]);
|
|
||||||
},
|
|
||||||
error: err => {
|
|
||||||
this.ErrorMsg = err.error;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
PostEditJob(jobListing: JobListing){
|
|
||||||
this.http.post("api/joblisting", jobListing).subscribe({
|
|
||||||
next: data => {
|
|
||||||
this.router.navigate([""]);
|
|
||||||
},
|
|
||||||
error: err => {
|
|
||||||
this.ErrorMsg = err.error;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SubmitForm(job: JobListing){
|
|
||||||
if (this.mode === "new"){
|
if (this.mode === "new"){
|
||||||
this.PostNewJob(job);
|
jobListing.companyID = this.modeID;
|
||||||
}else if (this.mode === "edit"){
|
} else if (this.mode === "edit"){
|
||||||
this.PostEditJob(job);
|
jobListing.id = this.modeID;
|
||||||
}
|
}
|
||||||
|
this.http.post("api/joblisting", jobListing).subscribe({
|
||||||
|
next: data => {
|
||||||
|
this.router.navigate([""]);
|
||||||
|
},
|
||||||
|
error: err => {
|
||||||
|
this.ErrorMsg = err.error;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -39,15 +39,4 @@ export class JobsComponent {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RemoveJobListing( JobListingID: number ){
|
|
||||||
this.http.delete("api/joblisting?JobListingID=" + JobListingID).subscribe({
|
|
||||||
next: data => {
|
|
||||||
window.location.reload();
|
|
||||||
},
|
|
||||||
error: err => {
|
|
||||||
this.ErrorMsg = err.error;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ namespace BoredCareers.Controllers {
|
|||||||
|
|
||||||
public AuthenticationController(DatabaseService db) : base(db) { }
|
public AuthenticationController(DatabaseService db) : base(db) { }
|
||||||
|
|
||||||
[HttpPost("loginState")]
|
[HttpPost("loginstate")]
|
||||||
public ActionResult<Account> LoginState() {
|
public ActionResult<Account> LoginState() {
|
||||||
if (isLoggedIn()) {
|
if (isLoggedIn()) {
|
||||||
return Ok(getLoggedInUser());
|
return Ok(getLoggedInUser());
|
||||||
|
|||||||
@@ -35,8 +35,12 @@ namespace BoredCareers.Controllers {
|
|||||||
Company? test = await _databaseService.GetCompany(Convert.ToInt32(company.ID));
|
Company? test = await _databaseService.GetCompany(Convert.ToInt32(company.ID));
|
||||||
if (test == null) {
|
if (test == null) {
|
||||||
company.ID = await _databaseService.SetCompany(company);
|
company.ID = await _databaseService.SetCompany(company);
|
||||||
|
|
||||||
|
|
||||||
await _databaseService.SetEmployee(new Employee() {
|
await _databaseService.SetEmployee(new Employee() {
|
||||||
AccountID = getLoggedInUserID(),
|
AccountID = getLoggedInUserID(),
|
||||||
|
AccountName = getLoggedInUser().UserName,
|
||||||
|
AccountEmail = getLoggedInUser().Email,
|
||||||
Company = company
|
Company = company
|
||||||
});
|
});
|
||||||
return Ok();
|
return Ok();
|
||||||
@@ -66,7 +70,7 @@ namespace BoredCareers.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("sendverifyemail")]
|
[HttpGet("sendverifyemail")]
|
||||||
public async Task<ActionResult<string>> SendVerify([FromQuery] int CompanyID) {
|
public async Task<ActionResult> SendVerify([FromQuery] int CompanyID) {
|
||||||
try {
|
try {
|
||||||
string key = "v" + CompanyID;
|
string key = "v" + CompanyID;
|
||||||
// Stop from sending multiple emails quickly
|
// Stop from sending multiple emails quickly
|
||||||
@@ -99,7 +103,7 @@ namespace BoredCareers.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("verifyemail")]
|
[HttpGet("verifyemail")]
|
||||||
public async Task<ActionResult<bool>> VerifyEmail([FromQuery] int CompanyID, [FromQuery] string EmailToken) {
|
public async Task<ActionResult> VerifyEmail([FromQuery] int CompanyID, [FromQuery] string EmailToken) {
|
||||||
try {
|
try {
|
||||||
Company? test = await _databaseService.GetCompany(CompanyID);
|
Company? test = await _databaseService.GetCompany(CompanyID);
|
||||||
if (test != null) {
|
if (test != null) {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
namespace BoredCareers.Entities {
|
namespace BoredCareers.Entities {
|
||||||
|
|
||||||
public class Company {
|
public class Company {
|
||||||
public int? ID { get; set; } // PK
|
public int? ID { get; set; } // PK
|
||||||
public string Name { get; set; } = "";
|
public string Name { get; set; } = "";
|
||||||
@@ -17,11 +16,4 @@ namespace BoredCareers.Entities {
|
|||||||
public string City { get; set; } = "";
|
public string City { get; set; } = "";
|
||||||
public string Description { get; set; } = "";
|
public string Description { get; set; } = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Employee {
|
|
||||||
public int? ID { get; set; } // PK
|
|
||||||
public int AccountID { get; set; } // FK
|
|
||||||
public Company Company { get; set; } = new Company(); // FK
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace BoredCareers.Entities {
|
||||||
|
public class Employee {
|
||||||
|
public int? ID { get; set; } // PK
|
||||||
|
public int AccountID { get; set; }
|
||||||
|
public string AccountName { get; set; } = "";
|
||||||
|
public string AccountEmail { get; set; } = "";
|
||||||
|
public Company Company { get; set; } = new Company(); // FK
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
namespace BoredCareers.Entities {
|
namespace BoredCareers.Entities {
|
||||||
|
|
||||||
public class JobListing {
|
public class JobListing {
|
||||||
public int? ID { get; set; } // PK
|
public int? ID { get; set; } // PK
|
||||||
public int CompanyID { get; set; } // FK
|
public int CompanyID { get; set; } // FK
|
||||||
@@ -25,5 +24,4 @@ namespace BoredCareers.Entities {
|
|||||||
public string Name { get; set; } = "";
|
public string Name { get; set; } = "";
|
||||||
public string Description { get; set; } = "";
|
public string Description { get; set; } = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
namespace BoredCareers.Entities {
|
namespace BoredCareers.Entities {
|
||||||
|
|
||||||
public class Resume {
|
public class Resume {
|
||||||
public int? ID { get; set; } // PK
|
public int? ID { get; set; } // PK
|
||||||
public int AccountID { get; set; } // FK
|
public int AccountID { get; set; } // FK
|
||||||
@@ -106,5 +105,4 @@ namespace BoredCareers.Entities {
|
|||||||
public string URL { get; set; } = "";
|
public string URL { get; set; } = "";
|
||||||
public string Description { get; set; } = "";
|
public string Description { get; set; } = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,8 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
while( await reader.ReadAsync() ) {
|
while( await reader.ReadAsync() ) {
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _accountid = reader.GetInt32("AccountID");
|
int _accountid = reader.GetInt32("AccountID");
|
||||||
|
string _accountname = reader.GetString("AccountName");
|
||||||
|
string _accountemail = reader.GetString("AccountEmail");
|
||||||
int _companyid = reader.GetInt32("CompanyID");
|
int _companyid = reader.GetInt32("CompanyID");
|
||||||
string _name = reader.GetString("Name");
|
string _name = reader.GetString("Name");
|
||||||
string _email = reader.GetString("Email");
|
string _email = reader.GetString("Email");
|
||||||
@@ -42,6 +44,8 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
employee = new Employee() {
|
employee = new Employee() {
|
||||||
ID = _id,
|
ID = _id,
|
||||||
AccountID = _accountid,
|
AccountID = _accountid,
|
||||||
|
AccountName = _accountname,
|
||||||
|
AccountEmail = _accountemail,
|
||||||
Company = new Company {
|
Company = new Company {
|
||||||
ID = _companyid,
|
ID = _companyid,
|
||||||
Name = _name,
|
Name = _name,
|
||||||
@@ -82,6 +86,8 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _accountid = reader.GetInt32("AccountID");
|
int _accountid = reader.GetInt32("AccountID");
|
||||||
|
string _accountname = reader.GetString("AccountName");
|
||||||
|
string _accountemail = reader.GetString("AccountEmail");
|
||||||
int _companyid = reader.GetInt32("CompanyID");
|
int _companyid = reader.GetInt32("CompanyID");
|
||||||
string _name = reader.GetString("Name");
|
string _name = reader.GetString("Name");
|
||||||
string _email = reader.GetString("Email");
|
string _email = reader.GetString("Email");
|
||||||
@@ -99,6 +105,8 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
employees.Add(new Employee() {
|
employees.Add(new Employee() {
|
||||||
ID = _id,
|
ID = _id,
|
||||||
AccountID = _accountid,
|
AccountID = _accountid,
|
||||||
|
AccountName = _accountname,
|
||||||
|
AccountEmail = _accountemail,
|
||||||
Company = new Company {
|
Company = new Company {
|
||||||
ID = _companyid,
|
ID = _companyid,
|
||||||
Name = _name,
|
Name = _name,
|
||||||
@@ -139,6 +147,8 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _accountid = reader.GetInt32("AccountID");
|
int _accountid = reader.GetInt32("AccountID");
|
||||||
|
string _accountname = reader.GetString("AccountName");
|
||||||
|
string _accountemail = reader.GetString("AccountEmail");
|
||||||
int _companyid = reader.GetInt32("CompanyID");
|
int _companyid = reader.GetInt32("CompanyID");
|
||||||
string _name = reader.GetString("Name");
|
string _name = reader.GetString("Name");
|
||||||
string _email = reader.GetString("Email");
|
string _email = reader.GetString("Email");
|
||||||
@@ -156,6 +166,8 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
employees.Add(new Employee() {
|
employees.Add(new Employee() {
|
||||||
ID = _id,
|
ID = _id,
|
||||||
AccountID = _accountid,
|
AccountID = _accountid,
|
||||||
|
AccountName = _accountname,
|
||||||
|
AccountEmail = _accountemail,
|
||||||
Company = new Company {
|
Company = new Company {
|
||||||
ID = _companyid,
|
ID = _companyid,
|
||||||
Name = _name,
|
Name = _name,
|
||||||
@@ -184,9 +196,9 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
|
|
||||||
string command = @"
|
string command = @"
|
||||||
INSERT INTO Employee
|
INSERT INTO Employee
|
||||||
(ID,AccountID,CompanyID)
|
(ID,AccountID,AccountName,AccountEmail,CompanyID)
|
||||||
VALUES
|
VALUES
|
||||||
(@ID,@AccountID,@CompanyID)
|
(@ID,@AccountID,@AccountName,@AccountEmail,@CompanyID)
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
AccountID = @AccountID,
|
AccountID = @AccountID,
|
||||||
CompanyID = @CompanyID;
|
CompanyID = @CompanyID;
|
||||||
@@ -195,6 +207,8 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||||
cmd.Parameters.AddWithValue("@ID", employee.ID);
|
cmd.Parameters.AddWithValue("@ID", employee.ID);
|
||||||
cmd.Parameters.AddWithValue("@AccountID", employee.AccountID);
|
cmd.Parameters.AddWithValue("@AccountID", employee.AccountID);
|
||||||
|
cmd.Parameters.AddWithValue("@AccountName", employee.AccountName);
|
||||||
|
cmd.Parameters.AddWithValue("@AccountEmail", employee.AccountEmail);
|
||||||
cmd.Parameters.AddWithValue("@CompanyID", employee.Company.ID);
|
cmd.Parameters.AddWithValue("@CompanyID", employee.Company.ID);
|
||||||
|
|
||||||
await cmd.ExecuteNonQueryAsync();
|
await cmd.ExecuteNonQueryAsync();
|
||||||
|
|||||||
Reference in New Issue
Block a user