Added the backend API for Delivery and updated the Delivery service
This commit is contained in:
@@ -286,7 +286,6 @@ app.put("/api/delivery/update/:id", async(req, res)=> {
|
|||||||
})
|
})
|
||||||
|
|
||||||
//TODO: FIx the file structure
|
//TODO: FIx the file structure
|
||||||
//TODO: delivery Update
|
|
||||||
//TODO: delivery Delete
|
//TODO: delivery Delete
|
||||||
|
|
||||||
const PORT = 3000;
|
const PORT = 3000;
|
||||||
|
|||||||
@@ -36,13 +36,6 @@ export class ClientServiceComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// if(this.data.delivery_date === this.today) {
|
|
||||||
// console.log("Date Matched")
|
|
||||||
// } else {
|
|
||||||
// console.log("Date does not matched")
|
|
||||||
// console.log(this.data.delivery_date)
|
|
||||||
// console.log(this.today)
|
|
||||||
// }
|
|
||||||
this.allDeliverySubscription = this.clientDeliveryService.allDelivery().subscribe(data=>{
|
this.allDeliverySubscription = this.clientDeliveryService.allDelivery().subscribe(data=>{
|
||||||
this.allDeliveryTasks = data;
|
this.allDeliveryTasks = data;
|
||||||
})
|
})
|
||||||
@@ -54,7 +47,6 @@ export class ClientServiceComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
completedTask(client: DeliveryModel): void {
|
completedTask(client: DeliveryModel): void {
|
||||||
client.delivery_status = "Completed";
|
client.delivery_status = "Completed";
|
||||||
//TODO11: When Completed is pressed send request to backend to change delivery Status to completed
|
|
||||||
this.clientDeliveryService.updateStatus(client).subscribe(response=>{
|
this.clientDeliveryService.updateStatus(client).subscribe(response=>{
|
||||||
console.log(response)
|
console.log(response)
|
||||||
this.clientDeliveryService.allDelivery().subscribe(data=>{
|
this.clientDeliveryService.allDelivery().subscribe(data=>{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { HttpClient } from "@angular/common/http";
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { DeliveryModel } from "./client-service.model";
|
import { DeliveryModel } from "./client-service.model";
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
import { DELIVERY_CREATE_URL, DELIVERY_UPDATE_URL, DELIVERY_URL } from "../../../shared/constants/backend";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -14,15 +15,15 @@ export class ClientDeliveryService {
|
|||||||
constructor(private httpClient: HttpClient){}
|
constructor(private httpClient: HttpClient){}
|
||||||
|
|
||||||
allDelivery(): Observable<DeliveryModel[]> {
|
allDelivery(): Observable<DeliveryModel[]> {
|
||||||
return this.httpClient.get<DeliveryModel[]>("http://localhost:3000/api/delivery")
|
return this.httpClient.get<DeliveryModel[]>(DELIVERY_URL)
|
||||||
}
|
}
|
||||||
|
|
||||||
addNewClientToDB(newClient: DeliveryModel){
|
addNewClientToDB(newClient: DeliveryModel){
|
||||||
return this.httpClient.post("http://localhost:3000/api/delivery/create", newClient)
|
return this.httpClient.post(DELIVERY_CREATE_URL, newClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatus(newStatus: DeliveryModel) {
|
updateStatus(newStatus: DeliveryModel) {
|
||||||
return this.httpClient.put(`http://localhost:3000/api/delivery/update/${newStatus._id}`, newStatus, {responseType: 'text'})
|
return this.httpClient.put(`${DELIVERY_UPDATE_URL}/${newStatus._id}`, newStatus, {responseType: 'text'})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export const service_links: navLink[] =[
|
|||||||
export const shift_tasks = [
|
export const shift_tasks = [
|
||||||
{
|
{
|
||||||
"name" : "Client Delivery",
|
"name" : "Client Delivery",
|
||||||
"url" : "http://localhost:12180/delivery" //TODO: Fix the localhost Name after full client delivery development
|
"url" : "http://118.67.213.117:12180/delivery"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Monitoring Screenshots list",
|
"name": "Monitoring Screenshots list",
|
||||||
|
|||||||
@@ -6,3 +6,6 @@ export const UPDATE_ADD_URL = `${UPDATE_GET_URL}/add`;
|
|||||||
export const UPDATE_COMPLETE_URL = `${UPDATE_GET_URL}/complete`;
|
export const UPDATE_COMPLETE_URL = `${UPDATE_GET_URL}/complete`;
|
||||||
export const UPDATE_DELETE_URL = `${UPDATE_GET_URL}/delete`;
|
export const UPDATE_DELETE_URL = `${UPDATE_GET_URL}/delete`;
|
||||||
export const SECRET_URL = `${MAIN_URL}/secrets`;
|
export const SECRET_URL = `${MAIN_URL}/secrets`;
|
||||||
|
export const DELIVERY_URL = `${MAIN_URL}/delivery`
|
||||||
|
export const DELIVERY_CREATE_URL = `${DELIVERY_URL}/create`
|
||||||
|
export const DELIVERY_UPDATE_URL = `${DELIVERY_URL}/update`
|
||||||
|
|||||||
Reference in New Issue
Block a user