Skip to content

Commit

Permalink
feat: added shelter category column
Browse files Browse the repository at this point in the history
  • Loading branch information
fagundesjg committed May 17, 2024
1 parent da491dc commit a4be895
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
6 changes: 6 additions & 0 deletions prisma/migrations/20240517192040_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- CreateEnum
CREATE TYPE "ShelterCategory" AS ENUM ('Shelter', 'DistributionCenter');

-- AlterTable
ALTER TABLE "shelters" ADD COLUMN "actived" BOOLEAN NOT NULL DEFAULT true,
ADD COLUMN "category" "ShelterCategory" NOT NULL DEFAULT 'Shelter';
29 changes: 18 additions & 11 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ enum AccessLevel {
Admin
}

enum ShelterCategory {
Shelter
DistributionCenter
}

model User {
id String @id @default(uuid())
name String
Expand Down Expand Up @@ -85,25 +90,27 @@ model Supply {
}

model Shelter {
id String @id @default(uuid())
name String @unique
pix String? @unique
id String @id @default(uuid())
name String @unique
pix String? @unique
address String
street String?
neighbourhood String?
city String?
streetNumber String? @map("street_number")
zipCode String? @map("zip_code")
petFriendly Boolean? @map("pet_friendly")
shelteredPeople Int? @map("sheltered_people")
streetNumber String? @map("street_number")
zipCode String? @map("zip_code")
petFriendly Boolean? @map("pet_friendly")
shelteredPeople Int? @map("sheltered_people")
capacity Int?
contact String?
prioritySum Int @default(value: 0) @map("priority_sum")
prioritySum Int @default(value: 0) @map("priority_sum")
latitude Float?
longitude Float?
verified Boolean @default(value: false)
createdAt String @map("created_at") @db.VarChar(32)
updatedAt String? @map("updated_at") @db.VarChar(32)
verified Boolean @default(value: false)
category ShelterCategory @default(value: Shelter)
actived Boolean @default(value: true)
createdAt String @map("created_at") @db.VarChar(32)
updatedAt String? @map("updated_at") @db.VarChar(32)
shelterManagers ShelterManagers[]
shelterSupplies ShelterSupply[]
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 @@ -87,6 +87,8 @@ export class ShelterService implements OnModuleInit {
latitude: true,
longitude: true,
verified: true,
actived: true,
category: true,
shelterSupplies: {
select: {
priority: true,
Expand Down Expand Up @@ -159,6 +161,8 @@ export class ShelterService implements OnModuleInit {
verified: true,
latitude: true,
longitude: true,
actived: true,
category: true,
createdAt: true,
updatedAt: true,
shelterSupplies: {
Expand Down

0 comments on commit a4be895

Please sign in to comment.