[portal][feat] add ranking for cities

pull/555/head
Yangshun Tay 2 years ago
parent 429067dfd5
commit 7f140afb6a

@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "City" ADD COLUMN "ranking" INTEGER DEFAULT 0;
-- AlterTable
ALTER TABLE "Company" ADD COLUMN "ranking" INTEGER DEFAULT 0;

@ -99,6 +99,8 @@ model Company {
description String? @db.Text
logoUrl String?
website String?
// The higher the value of the ranking, the higher it appears in the search results.
ranking Int? @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@ -133,6 +135,8 @@ model City {
id String @id
name String
stateId String
// The higher the value of the ranking, the higher it appears in the search results.
ranking Int? @default(0)
state State @relation(fields: [stateId], references: [id])
questionsQuestionEncounters QuestionsQuestionEncounter[]
OffersExperience OffersExperience[]

@ -10,7 +10,7 @@ export const locationsRouter = createRouter()
async resolve({ ctx, input }) {
return await ctx.prisma.city.findMany({
orderBy: {
name: 'asc',
ranking: 'desc',
},
select: {
id: true,

Loading…
Cancel
Save