Create a feature that allows makers to withdraw their application (bid) from a project. Before the application is withdrawn, the maker should be asked to confirm the action to prevent accidental withdrawals.
Requirements
Withdraw Application Functionality:
Allow makers to withdraw their applications from projects they have bid on.
Display a "Withdraw Application" button next to the maker's application details.
Ensure that only the maker who placed the bid can withdraw it.
Confirmation Prompt:
When the "Withdraw Application" button is clicked, display a confirmation prompt asking, "Are you sure you want to withdraw your application?"
Include "Yes" and "No" options in the confirmation prompt.
Only withdraw the application if the maker confirms the action by selecting "Yes".
Application Withdrawal:
If the maker confirms the withdrawal, remove the bid from the database.
Display a success message indicating that the application has been successfully withdrawn.
Update the project details to reflect the withdrawal of the application.
Acceptance Criteria
Makers can withdraw their applications with a "Withdraw Application" button.
A confirmation prompt appears before an application is withdrawn.
The application is only withdrawn if the maker confirms the action.
A success message is displayed, and the project details are updated accordingly.
Additional Information
Ensure the component is responsive and accessible.
Provide clear error messages for any issues in withdrawing the application.
Mockups / Examples
Provide any mockups or examples of the desired component if available.
Technical Requirements
Ensure compatibility with the existing tech stack of the project.
Utilize efficient algorithms to handle application withdrawal without significant performance degradation.
Mongoose Schema for Reference
const mongoose = require('mongoose');
const projectSchema = mongoose.Schema({
"title": String,
"description": String,
"requirements": String,
"budget": Number,
"deadline": Date,
"consumerId": String, // Reference to the user who posted the project
"category": String,
"images": [
{
"url": String, // URL of the image stored in an external service
"description": String, // Optional description of the image
"uploadedAt": Date // Timestamp when the image was uploaded
}
],
"selectedBidder": String, // Reference to the selected bidder (if any)
"status": String, // "open", "closed", "in progress", "completed"
"createdAt": Date,
"updatedAt": Date
});
projectSchema.virtual('id').get(function () {
return this._id.toHexString();
});
projectSchema.set('toJSON', {
virtuals: true,
});
module.exports = mongoose.model('project', projectSchema);
const bidSchema = mongoose.Schema({
"project_id": { type: mongoose.Schema.Types.ObjectId, ref: 'project' },
"maker_id": { type: mongoose.Schema.Types.ObjectId, ref: 'user' },
"bid_amount": Number,
"proposal_text": String,
"status": { type: String, enum: ['Pending', 'Accepted', 'Rejected'], default: 'Pending' },
"created_at": { type: Date, default: Date.now },
"updated_at": { type: Date, default: Date.now }
});
bidSchema.virtual('id').get(function () {
return this._id.toHexString();
});
bidSchema.set('toJSON', {
virtuals: true,
});
module.exports = mongoose.model('bid', bidSchema);
Steps to Implement
Update Backend Endpoint:
Create an endpoint to handle application (bid) withdrawal requests.
Description
Create a feature that allows makers to withdraw their application (bid) from a project. Before the application is withdrawn, the maker should be asked to confirm the action to prevent accidental withdrawals.
Requirements
Withdraw Application Functionality:
Confirmation Prompt:
Application Withdrawal:
Acceptance Criteria
Additional Information
Mockups / Examples
Provide any mockups or examples of the desired component if available.
Technical Requirements
Mongoose Schema for Reference
Steps to Implement
Update Backend Endpoint:
Update Frontend Component:
Integrate and Test:
Tasks