Added the backend API for Delivery and updated the Delivery service

This commit is contained in:
Md. Mosiur Rahman
2025-03-24 00:29:15 +06:00
parent 830ef855d6
commit f3dcf42a88
5 changed files with 8 additions and 13 deletions

View File

@@ -36,13 +36,6 @@ export class ClientServiceComponent implements OnInit, OnDestroy {
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.allDeliveryTasks = data;
})
@@ -54,7 +47,6 @@ export class ClientServiceComponent implements OnInit, OnDestroy {
completedTask(client: DeliveryModel): void {
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=>{
console.log(response)
this.clientDeliveryService.allDelivery().subscribe(data=>{

View File

@@ -2,6 +2,7 @@ import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { DeliveryModel } from "./client-service.model";
import { Observable } from "rxjs";
import { DELIVERY_CREATE_URL, DELIVERY_UPDATE_URL, DELIVERY_URL } from "../../../shared/constants/backend";
@Injectable({
providedIn: 'root'
@@ -14,15 +15,15 @@ export class ClientDeliveryService {
constructor(private httpClient: HttpClient){}
allDelivery(): Observable<DeliveryModel[]> {
return this.httpClient.get<DeliveryModel[]>("http://localhost:3000/api/delivery")
return this.httpClient.get<DeliveryModel[]>(DELIVERY_URL)
}
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) {
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'})
}

View File

@@ -114,7 +114,7 @@ export const service_links: navLink[] =[
export const shift_tasks = [
{
"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",