Skip to content

Commit 7f140af

Browse files
committed
[portal][feat] add ranking for cities
1 parent 429067d commit 7f140af

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- AlterTable
2+
ALTER TABLE "City" ADD COLUMN "ranking" INTEGER DEFAULT 0;
3+
4+
-- AlterTable
5+
ALTER TABLE "Company" ADD COLUMN "ranking" INTEGER DEFAULT 0;

apps/portal/prisma/schema.prisma

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ model Company {
9999
description String? @db.Text
100100
logoUrl String?
101101
website String?
102+
// The higher the value of the ranking, the higher it appears in the search results.
103+
ranking Int? @default(0)
102104
createdAt DateTime @default(now())
103105
updatedAt DateTime @updatedAt
104106
@@ -133,6 +135,8 @@ model City {
133135
id String @id
134136
name String
135137
stateId String
138+
// The higher the value of the ranking, the higher it appears in the search results.
139+
ranking Int? @default(0)
136140
state State @relation(fields: [stateId], references: [id])
137141
questionsQuestionEncounters QuestionsQuestionEncounter[]
138142
OffersExperience OffersExperience[]

apps/portal/src/server/router/locations-router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const locationsRouter = createRouter()
1010
async resolve({ ctx, input }) {
1111
return await ctx.prisma.city.findMany({
1212
orderBy: {
13-
name: 'asc',
13+
ranking: 'desc',
1414
},
1515
select: {
1616
id: true,

0 commit comments

Comments
 (0)