Skip to content

Commit

Permalink
fix-krishnaacharyaa#77: Refactor Form validation using react-hook-for…
Browse files Browse the repository at this point in the history
…m and zod
  • Loading branch information
ShristiSharan committed Jun 1, 2024
2 parents f611e0f + b72d61b commit 539ecbe
Show file tree
Hide file tree
Showing 58 changed files with 539 additions and 748 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/issue-assigned.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Issue Assigned Comment

on:
issues:
types: [assigned]

jobs:
comment-on-issue:
runs-on: ubuntu-latest
steps:
- name: Comment on the assigned issue
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = context.issue.number;
const issue_assignee = context.payload.assignee.login;
const contributing_guidelines_url = 'https://github.com/krishnaacharyaa/wanderlust/blob/main/.github/CONTRIBUTING.md';
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: `Hey @${issue_assignee} 🎉! Thanks for jumping on this issue. Before you dive in, please check out our [contributing guidelines](${contributing_guidelines_url}) to ensure we're all on the same page. Happy coding! 🚀`
});
10 changes: 5 additions & 5 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ else
echo "<tag>: <commit message> # if you don't have relevant issue"
echo ""
echo "Examples:"
echo "\033[31mFixed a bug\033[0m"
echo "\033[32mfix-#123: Fixed a bug\033[0m"
echo "\033[31mUpdated documentation file\033[0m"
echo "\033[32mchore: Updated documentation\033[0m"
echo "Fixed a bug"
echo "fix-#123: Fixed a bug"
echo "Updated documentation file"
echo "chore: Updated documentation"

echo ""
echo "To know all the available tags and for more details"
echo "Kindly refer to \033[0m\033[4;34m\033]8;;https://github.com/krishnaacharyaa/wanderlust/blob/9b11b769bb23150b746296cf9008056633d21921/.github/CONTRIBUTING.md#guidelines-for-contributions\a\033[4;34mContributing Guidelines\033]8;;\a\033[0m."
echo "Kindly refer to \033]8;;https://github.com/krishnaacharyaa/wanderlust/blob/9b11b769bb23150b746296cf9008056633d21921/.github/CONTRIBUTING.md#guidelines-for-contributions\aContributing Guidelines\033]8;;\a."
echo ""
exit 1
fi
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env sh

. "$(dirname -- "$0")/_/husky.sh"

cd frontend
Expand Down
7 changes: 4 additions & 3 deletions backend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
},
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"env": {
"node": true,
"jest": true,
"es2021": true,
"node": true
"es2021": true
},
"ignorePatterns": ["note_modules/"],

"plugins": ["babel", "jest", "prettier"],
"rules": {
"react/react-in-jsx-scope": "off",
"no-console": "off",
"import/extensions": "off"
}
Expand Down
29 changes: 15 additions & 14 deletions backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,34 @@ import errorMiddleware from './middlewares/error-middleware.js';

const app = express();

app.use(cors({
app.use(
cors({
// added origin
origin: FRONTEND_URL,
credentials: true
}));
credentials: true,
})
);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(compression());


// API route
app.use('/api/posts', postsRouter);
app.use('/api/auth', authRouter);
app.use('/api/user', userRouter);

app.get('/', (req, res) => {
res.send('Yay!! Backend of wanderlust app is now accessible');
res.send('Yay!! Backend of wanderlust app is now accessible');
});

app.all("*", (req, res) => {
res.status(404).json({
status: 404,
success: false,
message: "!Oops page not found"
})
})
app.all('*', (req, res) => {
res.status(404).json({
status: 404,
success: false,
message: '!Oops page not found',
});
});

app.use(errorMiddleware)
export default app;
app.use(errorMiddleware);
export default app;
3 changes: 1 addition & 2 deletions backend/config/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { MONGODB_URI } from './utils.js';
export default async function connectDB() {
try {
await mongoose.connect(MONGODB_URI, {
// set database name
dbName: 'wanderlust'
dbName: 'wanderlust',
});
console.log(`Database connected: ${MONGODB_URI}`);
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions backend/config/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const REFRESH_COOKIE_MAXAGE = process.env.REFRESH_COOKIE_MAXAGE;
const REFRESH_TOKEN_EXPIRES_IN = process.env.REFRESH_TOKEN_EXPIRES_IN;
const JWT_SECRET = process.env.JWT_SECRET;
const FRONTEND_URL = process.env.FRONTEND_URL;
const NODE_ENV = process.env.NODE_ENV
const NODE_ENV = process.env.NODE_ENV;

export {
MONGODB_URI,
Expand All @@ -22,5 +22,5 @@ export {
REFRESH_TOKEN_EXPIRES_IN,
JWT_SECRET,
FRONTEND_URL,
NODE_ENV
NODE_ENV,
};
Loading

0 comments on commit 539ecbe

Please sign in to comment.