Skip to content

Commit

Permalink
feat: add capacity and sheltered pets (#126)
Browse files Browse the repository at this point in the history
add fields in shelter table: pets capacity and sheltered pets 

Task:
https://sosriograndedosul.notion.site/Quando-o-abrigo-aceita-pets-habilitar-quantidade-de-vagas-e-capacidade-para-pets-414804de03f541d795e34baff7ee2371

Frontend PR is here:
[https://github.com/SOS-RS/frontend/pull/206](https://github.com/SOS-RS/frontend/pull/206)

---------

Co-authored-by: Everton Pavan <everton.pavan.dev@gmail.com>
  • Loading branch information
evertonpavan and Everton Pavan authored Sep 14, 2024
1 parent f819495 commit c48898e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
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 @@ -120,6 +120,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 @@ -86,6 +86,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 @@ -165,6 +167,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 @@ -19,6 +19,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 @@ -39,6 +41,8 @@ const CreateShelterSchema = ShelterSchema.omit({
const UpdateShelterSchema = ShelterSchema.pick({
petFriendly: true,
shelteredPeople: true,
shelteredPets: true,
petsCapacity: true,
}).partial();

const FullUpdateShelterSchema = ShelterSchema.omit({
Expand Down

0 comments on commit c48898e

Please sign in to comment.