Commit c1b1b97c by DESKTOP-E0VCCBD\zedan

update

parent 9df7d108
...@@ -14,7 +14,8 @@ exports.createUser = async (req, res) => { ...@@ -14,7 +14,8 @@ exports.createUser = async (req, res) => {
first_name: newUser.first_name, first_name: newUser.first_name,
last_name: newUser.last_name, last_name: newUser.last_name,
email: newUser.email, email: newUser.email,
role: newUser.role role: newUser.role,
phone: newUser.phone
} }
}); });
} catch (error) { } catch (error) {
......
...@@ -9,6 +9,12 @@ const User = sequelize.define('User', { ...@@ -9,6 +9,12 @@ const User = sequelize.define('User', {
defaultValue: DataTypes.UUIDV4, defaultValue: DataTypes.UUIDV4,
primaryKey: true, primaryKey: true,
}, },
profile_picture: {
type: DataTypes.STRING(500),
allowNull: true,
},
first_name: { first_name: {
type: DataTypes.STRING(100), type: DataTypes.STRING(100),
allowNull: false, allowNull: false,
...@@ -17,6 +23,10 @@ const User = sequelize.define('User', { ...@@ -17,6 +23,10 @@ const User = sequelize.define('User', {
type: DataTypes.STRING(100), type: DataTypes.STRING(100),
allowNull: false, allowNull: false,
}, },
phone: {
type: DataTypes.STRING(100),
allowNull: false,
},
email: { email: {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
allowNull: false, allowNull: false,
......
...@@ -11,51 +11,62 @@ import { EquipmentModel } from 'src/app/models/equipments.model'; ...@@ -11,51 +11,62 @@ import { EquipmentModel } from 'src/app/models/equipments.model';
export class ProductManagementComponent { export class ProductManagementComponent {
productList: EquipmentModel[] = [] productList: EquipmentModel[] = []
selectedProduct?: EquipmentModel selectedProduct?: EquipmentModel
constructor(private EquipmentService: EquipmentService) { } constructor(private EquipmentService: EquipmentService) { }
ngOnInit() { ngOnInit() {
this.getUser() this.getProduct()
} }
getUser() { getProduct() {
this.EquipmentService.getLists().subscribe(result => { this.EquipmentService.getLists().subscribe(result => {
this.productList = result this.productList = result
}) })
} }
getUserId() { getProductId() {
this.EquipmentService.getById("73079f3b-b58a-46e6-a779-20a64911e505").subscribe(result => { this.EquipmentService.getById("73079f3b-b58a-46e6-a779-20a64911e505").subscribe(result => {
console.log(result)
})
}
saveProduct() {
if (this.selectedProduct) {
this.EquipmentService.save(this.selectedProduct).subscribe(result => {
console.log(result) console.log(result)
}) })
} }
}
saveUser() {
if (this.selectedProduct) {
this.EquipmentService.save(this.selectedProduct).subscribe(result => {
console.log(result)
})
}
}
deleteUser() { updateProduct() {
if (this.selectedProduct) { if (this.selectedProduct) {
this.EquipmentService.delete(this.selectedProduct).subscribe(result => { this.EquipmentService.update(this.selectedProduct).subscribe(result => {
console.log(result) console.log(result)
}) })
}
} }
}
updateUser() { addToCart() {
if (this.selectedProduct) {
this.EquipmentService.update(this.selectedProduct).subscribe(result => {
console.log(result)
})
}
}
addToCart(){ }
deleteProduct(product: EquipmentModel) {
this.selectedProduct = new EquipmentModel(product)
if (this.selectedProduct) {
this.EquipmentService.delete(this.selectedProduct).subscribe(result => {
console.log(result)
})
} }
}
newproduct() {
this.selectedProduct = new EquipmentModel()
}
detailproduct(pj: EquipmentModel) {
this.selectedProduct = new EquipmentModel(pj)
} }
}
...@@ -10,8 +10,7 @@ import { ProjectService } from 'src/app/services/project.service'; ...@@ -10,8 +10,7 @@ import { ProjectService } from 'src/app/services/project.service';
}) })
export class ProjectManagementComponent { export class ProjectManagementComponent {
projectList:any[]=[]; projectList:ProJectModel[]=[];
selectedProject?: ProJectModel selectedProject?: ProJectModel
constructor(private projectService: ProjectService) { } constructor(private projectService: ProjectService) { }
...@@ -39,7 +38,8 @@ export class ProjectManagementComponent { ...@@ -39,7 +38,8 @@ export class ProjectManagementComponent {
} }
} }
deleteProject() { deleteProject(project:ProJectModel) {
this.selectedProject = new ProJectModel(project)
if (this.selectedProject) { if (this.selectedProject) {
this.projectService.delete(this.selectedProject).subscribe(result => { this.projectService.delete(this.selectedProject).subscribe(result => {
console.log(result) console.log(result)
...@@ -55,4 +55,13 @@ export class ProjectManagementComponent { ...@@ -55,4 +55,13 @@ export class ProjectManagementComponent {
} }
} }
newPj() {
this.selectedProject = new ProJectModel()
}
detailPj(pj: ProJectModel) {
this.selectedProject = new ProJectModel(pj)
}
} }
...@@ -3,6 +3,7 @@ import { BaseModel } from "./base.model"; ...@@ -3,6 +3,7 @@ import { BaseModel } from "./base.model";
export class EquipmentModel extends BaseModel { export class EquipmentModel extends BaseModel {
equipment_id: string; equipment_id: string;
picture: string;
equipment_name: string; equipment_name: string;
description?: string; description?: string;
quantity_total: number; quantity_total: number;
...@@ -13,6 +14,7 @@ export class EquipmentModel extends BaseModel { ...@@ -13,6 +14,7 @@ export class EquipmentModel extends BaseModel {
constructor(data?: Partial<EquipmentModel>, translateService?: TranslateService) { constructor(data?: Partial<EquipmentModel>, translateService?: TranslateService) {
super(data, translateService); super(data, translateService);
this.picture=data?.picture??'';
this.equipment_id = data?.equipment_id ?? ''; this.equipment_id = data?.equipment_id ?? '';
this.equipment_name = data?.equipment_name ?? ''; this.equipment_name = data?.equipment_name ?? '';
this.description = data?.description ?? ''; this.description = data?.description ?? '';
......
import { TranslateService } from "@ngx-translate/core"; import { TranslateService } from "@ngx-translate/core";
import { BaseModel } from "./base.model"; import { BaseModel } from "./base.model";
import { da } from "date-fns/locale";
export class ProJectModel extends BaseModel { export class ProJectModel extends BaseModel {
project_id: string; project_id: string;
picture: string;
project_name: string; project_name: string;
project_desc?: string; project_desc?: string;
start_date: string; start_date: string;
...@@ -12,6 +14,7 @@ export class ProJectModel extends BaseModel { ...@@ -12,6 +14,7 @@ export class ProJectModel extends BaseModel {
constructor(data?: Partial<ProJectModel>, translateService?: TranslateService) { constructor(data?: Partial<ProJectModel>, translateService?: TranslateService) {
super(data, translateService); super(data, translateService);
this.picture = data?.picture??'';
this.project_id = data?.project_id ?? ''; this.project_id = data?.project_id ?? '';
this.project_name = data?.project_name ?? ''; this.project_name = data?.project_name ?? '';
this.project_desc = data?.project_desc ?? ''; this.project_desc = data?.project_desc ?? '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment