Feat: Implement mapbox for geocoding and location data for brewery posts

This commit is contained in:
Aaron William Po
2023-04-24 21:45:11 -04:00
parent eec082e73a
commit 4aeafc0de8
17 changed files with 1845 additions and 134 deletions

View File

@@ -14,7 +14,12 @@ const getAllBreweryPosts = async (pageNum?: number, pageSize?: number) => {
take,
select: {
id: true,
location: true,
coordinates: true,
address: true,
city: true,
stateOrProvince: true,
country: true,
description: true,
name: true,
postedBy: { select: { username: true, id: true } },
breweryImages: { select: { path: true, caption: true, id: true, alt: true } },

View File

@@ -9,7 +9,12 @@ const getBreweryPostById = async (id: string) => {
await prisma.breweryPost.findFirst({
select: {
id: true,
location: true,
coordinates: true,
address: true,
city: true,
stateOrProvince: true,
country: true,
description: true,
name: true,
breweryImages: { select: { path: true, caption: true, id: true, alt: true } },
postedBy: { select: { username: true, id: true } },

View File

@@ -2,8 +2,13 @@ import { z } from 'zod';
const BreweryPostQueryResult = z.object({
id: z.string(),
location: z.string(),
name: z.string(),
description: z.string(),
address: z.string(),
city: z.string(),
stateOrProvince: z.string().or(z.null()),
coordinates: z.array(z.number()),
country: z.string().or(z.null()),
postedBy: z.object({ id: z.string(), username: z.string() }),
breweryImages: z.array(
z.object({ path: z.string(), caption: z.string(), id: z.string(), alt: z.string() }),