[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 description String? @db.Text
logoUrl String? logoUrl String?
website 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()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
@ -133,6 +135,8 @@ model City {
id String @id id String @id
name String name String
stateId 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]) state State @relation(fields: [stateId], references: [id])
questionsQuestionEncounters QuestionsQuestionEncounter[] questionsQuestionEncounters QuestionsQuestionEncounter[]
OffersExperience OffersExperience[] OffersExperience OffersExperience[]

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

Loading…
Cancel
Save