mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2026-02-03 10:34:43 +08:00
[portal][feat] add ranking for cities
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user