Skip to content

Commit

Permalink
CHORE: ran prettier format script
Browse files Browse the repository at this point in the history
  • Loading branch information
swarooppatilx committed Oct 31, 2024
1 parent 4b39191 commit e70e8f3
Show file tree
Hide file tree
Showing 52 changed files with 799 additions and 776 deletions.
5 changes: 1 addition & 4 deletions .github/ISSUE_TEMPLATE/Documentation.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 📝 Documentation Update
description: Improve Documentation
title: "[Doc]: "
title: '[Doc]: '
labels: [documentation]
body:
- type: checkboxes
Expand Down Expand Up @@ -66,6 +66,3 @@ body:
required: true
- label: 'I am willing to work on this issue (optional)'
required: false



56 changes: 28 additions & 28 deletions .github/ISSUE_TEMPLATE/custom.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "⚙️ Custom Issue"
description: "Submit a custom issue or suggestion for scruter."
title: "[Custom]: <Brief description of the issue>"
labels: ["custom", "status: needs triage"]
name: '⚙️ Custom Issue'
description: 'Submit a custom issue or suggestion for scruter.'
title: '[Custom]: <Brief description of the issue>'
labels: ['custom', 'status: needs triage']
body:
- type: markdown
attributes:
Expand All @@ -11,58 +11,58 @@ body:
- type: input
id: issue_summary
attributes:
label: "Issue Summary"
description: "Provide a summary of the custom issue."
placeholder: "E.g., Enhancement suggestion for search functionality"
label: 'Issue Summary'
description: 'Provide a summary of the custom issue.'
placeholder: 'E.g., Enhancement suggestion for search functionality'
validations:
required: true

- type: textarea
id: issue_description
attributes:
label: "Issue Description"
description: "Describe the issue or suggestion in detail."
placeholder: "Provide a detailed description of the custom issue, including the context, use case, or scenario in which this issue occurs or would be relevant..."
label: 'Issue Description'
description: 'Describe the issue or suggestion in detail.'
placeholder: 'Provide a detailed description of the custom issue, including the context, use case, or scenario in which this issue occurs or would be relevant...'
validations:
required: true

- type: textarea
id: proposed_solution
attributes:
label: "Proposed Solution (Optional)"
description: "If you have any ideas or suggestions for how to address this issue, describe them here."
placeholder: "Describe your proposed solution or approach..."
label: 'Proposed Solution (Optional)'
description: 'If you have any ideas or suggestions for how to address this issue, describe them here.'
placeholder: 'Describe your proposed solution or approach...'

- type: dropdown
id: priority
attributes:
label: "Priority"
description: "How important is this issue to you?"
label: 'Priority'
description: 'How important is this issue to you?'
options:
- "High - Requires urgent attention"
- "Medium - Should be addressed soon"
- "Low - Can be addressed later"
- 'High - Requires urgent attention'
- 'Medium - Should be addressed soon'
- 'Low - Can be addressed later'
validations:
required: true

- type: checkboxes
id: category
attributes:
label: "Category"
description: "Select the category that best describes the issue."
label: 'Category'
description: 'Select the category that best describes the issue.'
options:
- label: "Enhancement"
- label: "Refactor"
- label: "Security"
- label: "Design"
- label: "Other"
- label: 'Enhancement'
- label: 'Refactor'
- label: 'Security'
- label: 'Design'
- label: 'Other'

- type: textarea
id: additional_context
attributes:
label: "Additional Context (Optional)"
description: "Add any other context or information that might be relevant to this issue."
placeholder: "Provide any extra details, screenshots, or references that could help with understanding the issue..."
label: 'Additional Context (Optional)'
description: 'Add any other context or information that might be relevant to this issue.'
placeholder: 'Provide any extra details, screenshots, or references that could help with understanding the issue...'

- type: markdown
attributes:
Expand Down
16 changes: 8 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

version: 2
updates:
- package-ecosystem: "npm" # Specifies npm as the package manager
directory: "/" # Root directory where the package.json is located
- package-ecosystem: 'npm' # Specifies npm as the package manager
directory: '/' # Root directory where the package.json is located
schedule:
interval: "weekly" # Checks for updates every week
open-pull-requests-limit: 5 # Maximum number of open PRs at one time
interval: 'weekly' # Checks for updates every week
open-pull-requests-limit: 5 # Maximum number of open PRs at one time
commit-message:
prefix: "chore" # Prefixes commit messages with "chore"
prefix: 'chore' # Prefixes commit messages with "chore"
ignore:
- dependency-name: "some-package" # Example to ignore specific dependencies
versions: ["1.x", "2.0.0"] # Ignore specific versions, if necessary
- dependency-name: 'some-package' # Example to ignore specific dependencies
versions: ['1.x', '2.0.0'] # Ignore specific versions, if necessary
# Allows separate security updates if vulnerabilities are detected
allow:
- dependency-type: "all" # Monitors both dependencies and devDependencies
- dependency-type: 'all' # Monitors both dependencies and devDependencies
3 changes: 1 addition & 2 deletions .github/workflows/issue-reminder.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

name: 'open-issue reminder'

on:
schedule:
- cron: '15 4 * * *'
- cron: '15 4 * * *'
jobs:
welcome:
runs-on: ubuntu-latest
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
Scruter is a local classifieds and community platform where people can connect, buy, sell, and exchange services.
</p>



## Table of Contents

- [Join our Discord Server](#join-our-discord-server)
Expand Down Expand Up @@ -316,7 +314,6 @@ Big thanks to all the contributors who have helped make Scruter a better platfor
</p>
<p align="center">Happy coding and thanks for your contributions! 🎉</p>


## 🌐 Connect with Me

<div align="center">
Expand All @@ -340,6 +337,3 @@ Big thanks to all the contributors who have helped make Scruter a better platfor
---

Thank you for visiting! Feel free to reach out through any of the links above.



46 changes: 26 additions & 20 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,18 +403,19 @@ app.get('/market/form', ensureAuthenticated, (req, res) => {
});

app.get('/:type/edit/:id', ensureAuthenticated, async (req, res) => {
const { id, type } = req.params
if (!['food', 'house', 'market'].includes(type)) return res.status(400).render('400');
const { id, type } = req.params;
if (!['food', 'house', 'market'].includes(type))
return res.status(400).render('400');

const Model = type === 'food' ? Food : type === 'house' ? House : Market
const item = await Model.findById(id).catch(() => { });
const Model = type === 'food' ? Food : type === 'house' ? House : Market;
const item = await Model.findById(id).catch(() => {});
if (!item) return res.status(404).render('404');

if (req.session.user.username !== item.username)
return res.status(500).render('500');

res.render("edit", { item, type, activeLink: type });
})
res.render('edit', { item, type, activeLink: type });
});

// Handle search and display for houses
app.get('/house', async (req, res) => {
Expand Down Expand Up @@ -529,22 +530,28 @@ app.post(
body('description').notEmpty().withMessage('Description is required'),
body('email').isEmail().withMessage('Email is required and must be valid'),
body('phone').notEmpty().withMessage('Phone number is required'),
body('rent').custom((value, { req }) => req.params.type === 'house' ? value !== '' && !isNaN(value) : true),
body('price').custom((value, { req }) => req.params.type === 'market' ? value !== '' && !isNaN(value) : true),
body('rent').custom((value, { req }) =>
req.params.type === 'house' ? value !== '' && !isNaN(value) : true
),
body('price').custom((value, { req }) =>
req.params.type === 'market' ? value !== '' && !isNaN(value) : true
),
],
async (req, res) => {
const { type, id } = req.params;
if (!['food', 'house', 'market'].includes(type)) return res.status(400).render('400');
if (!['food', 'house', 'market'].includes(type))
return res.status(400).render('400');

const errors = validationResult(req);
if (!errors.isEmpty()) return res.status(400).render(`/edit/${type}/${id}`, {
type: req.params.type,
errors: errors.array(),
activeLink: req.params.activeLink,
});

const Model = type === 'food' ? Food : type === 'house' ? House : Market
const item = await Model.findById(id).catch(() => { });
if (!errors.isEmpty())
return res.status(400).render(`/edit/${type}/${id}`, {
type: req.params.type,
errors: errors.array(),
activeLink: req.params.activeLink,
});

const Model = type === 'food' ? Food : type === 'house' ? House : Market;
const item = await Model.findById(id).catch(() => {});
if (!item) return res.status(404).render('404');

if (req.session.user.username !== item.username)
Expand All @@ -559,7 +566,8 @@ app.post(
await item.save();

return res.redirect(`/${type}`);
})
}
);

// Handle search and display for market
// Handle search and display for market
Expand Down Expand Up @@ -601,7 +609,6 @@ app.get('/market', async (req, res) => {
}
});


// Handle form submission for market
app.post(
'/market',
Expand Down Expand Up @@ -805,7 +812,6 @@ app.post('/delete/:type/:id', ensureAuthenticated, async (req, res) => {
}
});


// 404 Error Handler
app.use((req, res) => {
res.status(404).render('404');
Expand Down
6 changes: 3 additions & 3 deletions public/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ body.dark-mode .icon-circle {
}

body.dark-mode .icon-circle:hover {

background-color: #fff !important;
}

Expand Down Expand Up @@ -218,10 +217,11 @@ body.dark-mode .card {
cursor: pointer;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
display: none;
transition: transform 0.3s ease, background-color 0.3s ease;
transition:
transform 0.3s ease,
background-color 0.3s ease;
}


.scroll-button.show-btn {
display: flex;
align-items: center;
Expand Down
23 changes: 10 additions & 13 deletions scruter-nextjs/actions/seller/login-action.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"use server"
'use server';
import { generateAndSendOTP } from '@/lib/auth';
import prismadb from '@/lib/prismadb';
import { Prisma, Seller } from '@prisma/client';

export async function SellerVerify({
email
}:{
email:string
}): Promise<{ success: boolean; error?: string ; data?:Seller}> {

email,
}: {
email: string;
}): Promise<{ success: boolean; error?: string; data?: Seller }> {
const exitingSeller = await prismadb.seller.findUnique({
where: {
email: email,
Expand All @@ -21,13 +20,11 @@ export async function SellerVerify({
error: 'seller does not exists',
};
}
const resp=await generateAndSendOTP(email,"seller");

if(!resp){
return {success:false, error:"Error occured in sending otp"};
}

return { success: true};
const resp = await generateAndSendOTP(email, 'seller');

if (!resp) {
return { success: false, error: 'Error occured in sending otp' };
}

return { success: true };
}
27 changes: 13 additions & 14 deletions scruter-nextjs/actions/seller/signup-action.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"use server"
'use server';
import { generateAndSendOTP } from '@/lib/auth';
import prismadb from '@/lib/prismadb';
import { Prisma, Seller } from '@prisma/client';

export async function SellerCreate({
name,email
}:{
name:string,
email:string
}): Promise<{ success: boolean; error?: string ; data?:Seller}> {

name,
email,
}: {
name: string;
email: string;
}): Promise<{ success: boolean; error?: string; data?: Seller }> {
const exitingSeller = await prismadb.seller.findUnique({
where: {
email: email,
Expand All @@ -31,18 +31,17 @@ export async function SellerCreate({
},
});

if(!res){
return {success:false, error:"Error occured in seller creation"};
if (!res) {
return { success: false, error: 'Error occured in seller creation' };
}

const resp=await generateAndSendOTP(res.email,"seller");
const resp = await generateAndSendOTP(res.email, 'seller');

if(!resp){
return {success:false, error:"Error occured in sending otp"};
if (!resp) {
return { success: false, error: 'Error occured in sending otp' };
}

return { success: true , data:res};

return { success: true, data: res };
} catch (err) {
if (err instanceof Prisma.PrismaClientKnownRequestError) {
console.log(err.message);
Expand Down
Loading

0 comments on commit e70e8f3

Please sign in to comment.