-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/arnav-jacob/upcoming-events-flow
- Loading branch information
Showing
43 changed files
with
1,256 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,3 +131,6 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# desktop services store | ||
.DS_Store |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { RequestHandler } from "express"; | ||
import TestimonialModel from "src/models/testimonial"; | ||
|
||
export const createTestimonial: RequestHandler = async (req, res, next) => { | ||
const { title, description, image, type } = req.body; | ||
console.log("here"); | ||
try { | ||
const testimonial = await TestimonialModel.create({ | ||
title: title, | ||
description: description, | ||
image: image, | ||
type: type, | ||
}); | ||
console.log("here"); | ||
res.status(201).json(testimonial); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; | ||
|
||
export const getAllTestimonials: RequestHandler = async (req, res, next) => { | ||
try { | ||
const testimonials = await TestimonialModel.find({}); | ||
res.status(200).json(testimonials); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { InferSchemaType, Schema, model } from "mongoose"; | ||
|
||
const testimonialSchema = new Schema({ | ||
title: { type: String, required: true }, | ||
description: { type: String, required: true }, | ||
image: { type: String, required: true }, | ||
type: { type: String, required: true }, | ||
}); | ||
|
||
type testimonial = InferSchemaType<typeof testimonialSchema>; | ||
|
||
export default model<testimonial>("testimonial", testimonialSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import express from "express"; | ||
import * as TestimonialController from "src/controllers/testimonial"; | ||
|
||
const router = express.Router(); | ||
|
||
router.get("/get", TestimonialController.getAllTestimonials); | ||
router.post("/post", TestimonialController.createTestimonial); | ||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { body } from "express-validator"; | ||
|
||
const makeIDValidator = () => | ||
body("_id") | ||
.exists() | ||
.withMessage("_id is required") | ||
.bail() | ||
.isMongoId() | ||
.withMessage("_id must be a MongoDB object ID"); | ||
|
||
const makeTitleValidator = () => | ||
body("title") | ||
// title must exist, if not this message will be displayed | ||
.exists() | ||
.withMessage("title is required") | ||
// bail prevents the remainder of the validation chain for this field from being executed if | ||
// there was an error | ||
.bail() | ||
.isString() | ||
.withMessage("title must be a string") | ||
.bail() | ||
.notEmpty() | ||
.withMessage("title cannot be empty"); | ||
const makeDescriptionValidator = () => | ||
body("description") | ||
// title must exist, if not this message will be displayed | ||
.exists() | ||
.withMessage("description is required") | ||
// bail prevents the remainder of the validation chain for this field from being executed if | ||
// there was an error | ||
.bail() | ||
.isString() | ||
.withMessage("description must be a string") | ||
.bail() | ||
.notEmpty() | ||
.withMessage("description cannot be empty"); | ||
|
||
const makeImageValidator = () => | ||
body("image") | ||
// title must exist, if not this message will be displayed | ||
.exists() | ||
.withMessage("image is required") | ||
// bail prevents the remainder of the validation chain for this field from being executed if | ||
// there was an error | ||
.bail() | ||
.isString() | ||
.withMessage("image must be a string") | ||
.bail() | ||
.notEmpty() | ||
.withMessage("image cannot be empty"); | ||
|
||
export const createTestimonial = [ | ||
makeTitleValidator(), | ||
makeDescriptionValidator(), | ||
makeImageValidator(), | ||
]; | ||
|
||
export const updateTestimonial = [ | ||
makeIDValidator(), | ||
makeTitleValidator(), | ||
makeDescriptionValidator(), | ||
makeImageValidator(), | ||
]; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { get, handleAPIError } from "./requests"; | ||
|
||
import type { APIResult } from "./requests"; | ||
export type Testimonial = { | ||
_id: string; | ||
title: string; | ||
description: string; | ||
image: string; | ||
type: string; | ||
}; | ||
|
||
export async function getAllTestimonials(): Promise<APIResult<Testimonial[]>> { | ||
try { | ||
const response = await get(`/api/testimonial/get`); | ||
//console.log(response); | ||
const json = (await response.json()) as Testimonial[]; | ||
//console.log(json); | ||
return { success: true, data: json }; | ||
} catch (error) { | ||
return handleAPIError(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.cards { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 48px; | ||
margin-left: 202px; | ||
margin-right: 202px; | ||
margin-bottom: 136px; | ||
} | ||
|
||
.backgroundImageContainer { | ||
position: relative; | ||
z-index: 0; | ||
background-color: blue; | ||
} | ||
|
||
.whiteCardsContainer { | ||
position: absolute; | ||
top: 557px; | ||
/* left: 0; */ | ||
z-index: 1; | ||
/* background-color: pink; */ | ||
} | ||
|
||
.cardsBackground { | ||
height: 866px; | ||
} |
Oops, something went wrong.