Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/admin #224

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

samriddhitiwary
Copy link
Contributor

Admin.1.mp4

Pull Request Template

Title: Create ADMIN page to CREATE, READ, UPDATE, and DELETE Products into MongoDB using existing CRUD API

Description

Please provide a clear and concise description of what this pull request does, including any relevant details.

Related Issue

Link to the issue that this pull request addresses (if applicable). Use the format: Fixes #165

Changes Made

This issue involves building an Admin page that allows for the Create, Read, Update, and Delete (CRUD) operations on Products stored in MongoDB. The page will interact with an existing CRUD API for product management. The page should include a form for product creation and editing, a table to display all products, and functionality to delete products.

Checklist

  • I have tested my code and it works as expected.

  • I have added/updated documentation where necessary.

  • I have included tests for new features.

  • I have followed the project's coding standards.

  • Checklist:

    • I have tested my code and it works as expected.
    • I have added documentation for the changes made.
    • I have included tests for the registration form validation.

Copy link

netlify bot commented Oct 20, 2024

Deploy Preview for scrollme-ecommerce ready!

Name Link
🔨 Latest commit 81580d0
🔍 Latest deploy log https://app.netlify.com/sites/scrollme-ecommerce/deploys/6714a1f85b1a5f000848e555
😎 Deploy Preview https://deploy-preview-224--scrollme-ecommerce.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@saurabhbakolia
Copy link
Owner

Hey @samriddhitiwary ,
This is cool, I am reviewing it.

Copy link

vercel bot commented Oct 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
scrollme-ecommerce-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 20, 2024 6:25am

@samriddhitiwary
Copy link
Contributor Author

@thakuratul2 I have resolved the conflicts

@samriddhitiwary
Copy link
Contributor Author

samriddhitiwary commented Oct 20, 2024

@saurabhbakolia @thakuratul2 I have resolved the conflict, could you please review the PR

@thakuratul2 thakuratul2 self-requested a review October 20, 2024 06:30
`}
</style>

<div className='container mt-5'>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on the app! I'd suggest using styled-components for more modular and maintainable styling.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I am making these changes.

@@ -4,7 +4,7 @@ const authMiddleware = require('../middleware/authMiddleware');
const productController = require('../controllers/productController');

// Route to add a new product (only for admins)
router.post('/add', authMiddleware, productController.addProduct);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can add the support to edit this, only for admins and sellers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of now, I have disabled all the auth flow. Later, we can add it in separate issue and PR?

app.use(cookieParser());
app.use(helmet());

app.use("/api/auth", authRoutes); // Authentication routes
app.use("/api/cart", authMiddleware, cartRoute); // Cart routes
app.use("/api/product", productRoute); // Product routes
app.use("/api/user", userRoute); // user routes
app.use("/api/auth", authStatusRoute); // Check Auth Status
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

@samriddhitiwary samriddhitiwary Oct 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saurabhbakolia
I am sorry, but, for time being, can we hold all Auth related flow, Its causing lots of issue in local. We can have separate issue to fix all the auth related work.

image

console.log(`Server running on port ${PORT}`);
console.log(`API available at http://localhost:${PORT}/api/auth`);
});
// const PORT = process.env.PORT || 8080;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to connect the MongoDB ATLAS. It seems, existing code was not compatible with ATLAS, So when i modified, It started working. I did not try with local mongo db.

@@ -10,6 +10,10 @@ import ProtectedRoute from './utils/ProtectedRoute';
import ContributorsPage from './pages/ContributorsPage';
import { lazy, Suspense } from 'react';
import ContactUsPage from './pages/ContactUsPage';
import Admin from './components/Admin';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you installed prettier and eslint in your IDE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will do it. I missed it.

@@ -13,11 +13,13 @@
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.6.0",
"bootstrap": "^5.3.3",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you install Bootstrap? We are using styled-components for styling and material-ui-icons for icons. Could you please stick to these for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check, I am not using anywhere. I will remove it.

"firebase": "^10.14.0",
"framer-motion": "^11.9.0",
"myapp": "file:",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hot-toast": "^2.4.1",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to use react-hot-toast; we're using chakra-ui, so please use their toast method instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check and will use chakra-ui.

@@ -42,14 +46,6 @@ function App() {
</Suspense>
}
/>
<Route
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you didn't pull the latest changes. Please avoid removing code unnecessarily.

background: `linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)), url('https://images.pexels.com/photos/6984650/pexels-photo-6984650.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940') center`,
backgroundSize: 'cover',
backgroundAttachment: 'fixed', // Keep the background fixed during scroll
minHeight: '100vh', // Ensure it covers the full height of the viewport
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary comments and logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do it.

@samriddhitiwary
Copy link
Contributor Author

@saurabhbakolia Ok I will check it again

@saurabhbakolia
Copy link
Owner

@saurabhbakolia Ok I will check it again

Hey @samriddhitiwary,

if you can make the required changes so that I can merge this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants