This commit is contained in:
2025-06-16 16:57:13 +05:00
parent d0562c4629
commit c84c13a7ad
3 changed files with 11 additions and 126 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ for (const {
unit_type,
unit_view,
balcony_area,
} of unitsOfMarasiDrive.concat(unitsOfDubaiMarina)) {
} of unitsOfMarasiDrive) {
type Unit = typeof unitsTable.$inferInsert;
const parts = unit_no.split("-");
+7 -97
View File
@@ -72,39 +72,11 @@ export const unitsController = new Elysia({ prefix: "/units" })
query: t.Partial(
t.Object({
project: t.String(),
unitTypes: t.Array(
t.Union([
t.Literal("Studio Squared"),
t.Literal("1 BR Squared"),
t.Literal("Studio Flex"),
t.Literal("2 BR Squared"),
t.Literal("Studio2"),
t.Literal("One Bedroom2"),
t.Literal("One Bedroom Loft"),
t.Literal("Two Bedroom Loft"),
])
),
unitTypes: t.Array(t.String()),
cost: t.Tuple([t.Number(), t.Number()]),
floor: t.Tuple([t.Number(), t.Number()]),
area: t.Tuple([t.Number(), t.Number()]),
view: t.Union([
t.Literal("Canal / Amenities"),
t.Literal("Corner-Canal / Amenities"),
t.Literal("Corner-Canal View"),
t.Literal("Business Bay"),
t.Literal("Park Facing"),
t.Literal("Corner-Park Facing"),
t.Literal("Partial Park"),
t.Literal("BK/DT / Amenities"),
t.Literal("Corner-BK/DT / Amenities"),
t.Literal("Corner-Canal / BK/DT View"),
t.Literal("Marina View"),
t.Literal("Partial Marina View"),
t.Literal("Partial Marina, Partial City View"),
t.Literal("City view"),
t.Literal("Marina View, Sea View"),
t.Literal("Partial Marina View, Partial Sea View"),
]),
view: t.String(),
order: t.Tuple([
t.Union([t.Literal("cost"), t.Literal("sqft")]),
t.Union([t.Literal("asc"), t.Literal("desc")]),
@@ -150,39 +122,11 @@ export const unitsController = new Elysia({ prefix: "/units" })
query: t.Partial(
t.Object({
project: t.String(),
unitTypes: t.Array(
t.Union([
t.Literal("Studio Squared"),
t.Literal("1 BR Squared"),
t.Literal("Studio Flex"),
t.Literal("2 BR Squared"),
t.Literal("Studio2"),
t.Literal("One Bedroom2"),
t.Literal("One Bedroom Loft"),
t.Literal("Two Bedroom Loft"),
])
),
unitTypes: t.Array(t.String()),
cost: t.Tuple([t.Number(), t.Number()]),
floor: t.Tuple([t.Number(), t.Number()]),
area: t.Tuple([t.Number(), t.Number()]),
view: t.Union([
t.Literal("Canal / Amenities"),
t.Literal("Corner-Canal / Amenities"),
t.Literal("Corner-Canal View"),
t.Literal("Business Bay"),
t.Literal("Park Facing"),
t.Literal("Corner-Park Facing"),
t.Literal("Partial Park"),
t.Literal("BK/DT / Amenities"),
t.Literal("Corner-BK/DT / Amenities"),
t.Literal("Corner-Canal / BK/DT View"),
t.Literal("Marina View"),
t.Literal("Partial Marina View"),
t.Literal("Partial Marina, Partial City View"),
t.Literal("City view"),
t.Literal("Marina View, Sea View"),
t.Literal("Partial Marina View, Partial Sea View"),
]),
view: t.String(),
})
),
}
@@ -281,50 +225,16 @@ export const unitsController = new Elysia({ prefix: "/units" })
500: t.ObjectString({}),
},
params: t.Object({
filterName: t.Union([
t.Literal("unitTypes"),
t.Literal("views"),
t.Literal("cost"),
t.Literal("area"),
t.Literal("floor"),
]),
filterName: t.String(),
}),
query: t.Partial(
t.Object({
project: t.String(),
unitTypes: t.Array(
t.Union([
t.Literal("Studio Squared"),
t.Literal("1 BR Squared"),
t.Literal("Studio Flex"),
t.Literal("2 BR Squared"),
t.Literal("Studio2"),
t.Literal("One Bedroom2"),
t.Literal("One Bedroom Loft"),
t.Literal("Two Bedroom Loft"),
])
),
unitTypes: t.Array(t.String()),
cost: t.Tuple([t.Number(), t.Number()]),
floor: t.Tuple([t.Number(), t.Number()]),
area: t.Tuple([t.Number(), t.Number()]),
view: t.Union([
t.Literal("Canal / Amenities"),
t.Literal("Corner-Canal / Amenities"),
t.Literal("Corner-Canal View"),
t.Literal("Business Bay"),
t.Literal("Park Facing"),
t.Literal("Corner-Park Facing"),
t.Literal("Partial Park"),
t.Literal("BK/DT / Amenities"),
t.Literal("Corner-BK/DT / Amenities"),
t.Literal("Corner-Canal / BK/DT View"),
t.Literal("Marina View"),
t.Literal("Partial Marina View"),
t.Literal("Partial Marina, Partial City View"),
t.Literal("City view"),
t.Literal("Marina View, Sea View"),
t.Literal("Partial Marina View, Partial Sea View"),
]),
view: t.String(),
})
),
}
+3 -28
View File
@@ -12,39 +12,14 @@ export const unitsTable = pgTable(
floor: integer("floor").notNull(),
unitType: varchar("unit_type", {
length: 256,
enum: [
"Studio Squared",
"1 BR Squared",
"Studio Flex",
"2 BR Squared",
"One Bedroom2",
"Studio2",
"One Bedroom Loft",
"Two Bedroom Loft",
],
}),
noOfBathrooms: integer("no_of_bathrooms").notNull(),
unitView: varchar("unit_view", {
length: 256,
enum: [
"Canal / Amenities",
"Corner-Canal / Amenities",
"Corner-Canal View",
"Business Bay",
"Park Facing",
"Corner-Park Facing",
"Partial Park",
"BK/DT / Amenities",
"Corner-BK/DT / Amenities",
"Corner-Canal / BK/DT View",
"Marina View",
"Partial Marina View",
"Partial Marina, Partial City View",
"City view",
"Marina View, Sea View",
"Partial Marina View, Partial Sea View",
],
}),
// unitTypeVariant: varchar("unit_type_variant", {
// length: 256,
// }),
suitsArea: doublePrecision("suits_area").notNull(),
squareFt: doublePrecision("square_ft").notNull(),
noOfParkingSpace: integer("no_of_parking_space").notNull(),