Pet Adoption Service

Evgenii Vaniukov

Backend Engineer
Frontend Engineer
UX Engineer
ExpressJS
Next.js
TypeScript

Project Overview:

A Full-Stack application with a RESTful backend and Next.js (React) responsive frontend. The service incorporates CRUD operations to search, adopt, save and return pets.
Home Screen
Home Screen

Database

Created a relational data model of a service. Implemented the model with Prisma ORM and PostgreSQL.

Application

Get Pets API

pet.get("/", validateSchema(searchPetSchema), getPets);
Retrieves pets that match given filters.
Receives query parameters to search the database.
Retrieves results that match the query. If no parameters are passed, it returns all the results.
Search by pet name
Search by pet name

Get Pet By ID API

pet.get("/:id", getPetByID);
Returns corresponding pet from the database.
Stores pet information in the database.
Pet Details
Pet Details

Adopt/Foster API

pet.post("/:id/adopt", authProtect, adoptPet);
Adds a pet to the user's pets.
Changes pet’s adoption status.

Return Pet API

pet.post("/:id/return", authProtect, returnPet);
Returns a pet to the agency.
Changes adoption status to "available".
Removes a pet from a user's adopted pets list.
Save Pet API

Save Pet API

pet.post("/:id/save", authProtect, savePet);
Saves a pet for later.

Delete Saved Pet API

pet.delete("/:id/save", authProtect, unsavePet);
Removes a saved pet.

Get User's Adopted/Saved Pets

user.get("/pets", authProtect, getUserPetsHandler);
user.get("/pets/saved", authProtect, getUserSavedPetsHandler);
A list of user's adopted/saved pets
A list of user's adopted/saved pets

Admin Dashboard

Lists all the pets and provides functionality to ADD, UPDATE, and DELETE.
Lists all the users and provides functionality to see each user's adopted pets.
Allows to search for a user.
Admin Dashboard
Admin Dashboard

Add Pet API

pet.post("/", [validateSchema(postPetSchema), adminProtect], addPet);
The add pet API is responsible for adding new pets.
Validated all the user input with the AJV library.
export const postPetSchema = {
type: "object",
properties: {
type: {type: "string"},
name: {type: "string"},
adoptionStatus: {type: "string"},
picturePath: {type: "string"},
size: {type: "string"},
color: {type: "string"},
bio: {type: "string"},
hypoallergenic: {type: "string"},
dietaryRestrictions: {type: "string"},
breed: {type: "string"},
},
}
Add Pet Form
Add Pet Form

Edit Pet API

pet.patch("/:id", [validateSchema(patchPetSchema), adminProtect], editPet);
Same as ADD Pet API But with pet details already displayed in the form.

Authentification

Signup API

Validates user's input.
Checks that passwords match.
Ensures that the email does not exist in the database.
Hashes the user's password.
signup.post(
"/",
[validateSchema(signupSchema), passwordsMatch, emailIsUnique],
createNewUser
);

Login API

login.post("/", [validateSchema(loginSchema)], signin);
Checks that an email and a password match an existing user.
Returns JWT Token and logins a user.

Update User's Profile

user.put("/details", [authProtect, emailIsUnique], updateUserDetailsHandler);
user.put("/password", [authProtect, passwordsMatch], updateUserPasswordHandler);
Partner With Evgenii
View Services

More Projects by Evgenii