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

feat: add capacity and sheltered pets #126

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "shelters" ADD COLUMN "pets_capacity" INTEGER,
ADD COLUMN "sheltered_pets" INTEGER;
2 changes: 2 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ model Shelter {
streetNumber String? @map("street_number")
zipCode String? @map("zip_code")
petFriendly Boolean? @map("pet_friendly")
shelteredPets Int? @map("sheltered_pets")
petsCapacity Int? @map("pets_capacity")
shelteredPeople Int? @map("sheltered_people")
capacity Int?
contact String?
Expand Down
4 changes: 4 additions & 0 deletions src/shelter/shelter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export class ShelterService implements OnModuleInit {
capacity: true,
contact: shouldShowContact,
petFriendly: true,
shelteredPets: true,
petsCapacity: true,
prioritySum: true,
latitude: true,
longitude: true,
Expand Down Expand Up @@ -152,6 +154,8 @@ export class ShelterService implements OnModuleInit {
zipCode: true,
capacity: true,
petFriendly: true,
shelteredPets: true,
petsCapacity: true,
shelteredPeople: true,
prioritySum: true,
verified: true,
Expand Down
4 changes: 4 additions & 0 deletions src/shelter/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const ShelterSchema = z.object({
streetNumber: z.string().nullable().optional(),
zipCode: z.string().nullable().optional(),
petFriendly: z.boolean().nullable().optional(),
shelteredPets: z.number().min(0).nullable().optional(),
petsCapacity: z.number().min(0).nullable().optional(),
shelteredPeople: z.number().min(0).nullable().optional(),
latitude: z.number().nullable().optional(),
longitude: z.number().nullable().optional(),
Expand All @@ -38,6 +40,8 @@ const CreateShelterSchema = ShelterSchema.omit({
const UpdateShelterSchema = ShelterSchema.pick({
petFriendly: true,
shelteredPeople: true,
shelteredPets: true,
petsCapacity: true,
}).partial();

const FullUpdateShelterSchema = ShelterSchema.omit({
Expand Down