Skip to content

Commit

Permalink
release: 2024-06-10 (#1289)
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jun 10, 2024
2 parents c0a7ea6 + 5bec922 commit 78aa297
Show file tree
Hide file tree
Showing 35 changed files with 2,695 additions and 2,124 deletions.
18 changes: 9 additions & 9 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@emotion/react": "11.11.4",
"@emotion/server": "11.11.0",
"@hookform/resolvers": "3.5.0",
"@hookform/resolvers": "3.6.0",
"@mantine/carousel": "6.0.21",
"@mantine/core": "6.0.21",
"@mantine/dates": "6.0.21",
Expand All @@ -47,13 +47,13 @@
"@opentelemetry/sdk-trace-node": "1.25.0",
"@opentelemetry/semantic-conventions": "1.25.0",
"@prisma/instrumentation": "5.15.0",
"@sentry/browser": "7.116.0",
"@sentry/browser": "7.117.0",
"@sentry/integrations": "7.114.0",
"@sentry/nextjs": "7.116.0",
"@sentry/node": "7.116.0",
"@sentry/opentelemetry": "7.116.0",
"@sentry/nextjs": "7.117.0",
"@sentry/node": "7.117.0",
"@sentry/opentelemetry": "7.117.0",
"@sentry/opentelemetry-node": "7.114.0",
"@sentry/profiling-node": "7.116.0",
"@sentry/profiling-node": "7.117.0",
"@tanstack/react-query": "4.36.1",
"@tanstack/react-table": "8.17.3",
"@trpc/client": "10.45.2",
Expand Down Expand Up @@ -119,8 +119,8 @@
"@types/node": "20.14.2",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "7.12.0",
"@typescript-eslint/parser": "7.12.0",
"@typescript-eslint/eslint-plugin": "7.13.0",
"@typescript-eslint/parser": "7.13.0",
"@weareinreach/config": "workspace:*",
"@weareinreach/eslint-config": "workspace:*",
"@welldone-software/why-did-you-render": "8.0.1",
Expand All @@ -133,7 +133,7 @@
"prettier": "3.3.1",
"trpc-panel": "1.3.4",
"trpc-playground": "1.0.4",
"type-fest": "4.19.0",
"type-fest": "4.20.0",
"typescript": "5.4.5",
"webpack-bundle-analyzer": "4.10.2"
},
Expand Down
3 changes: 3 additions & 0 deletions apps/app/src/pages/org/[slug]/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { z } from 'zod'
import { trpcServerClient } from '@weareinreach/api/trpc'
import { checkServerPermissions } from '@weareinreach/auth'
import { GoogleMap } from '@weareinreach/ui/components/core/GoogleMap'
import { LocationDrawer } from '@weareinreach/ui/components/data-portal/LocationDrawer'
import { ContactSection } from '@weareinreach/ui/components/sections/ContactSection'
import { ListingBasicInfo } from '@weareinreach/ui/components/sections/ListingBasicInfo'
import { LocationCard } from '@weareinreach/ui/components/sections/LocationCard'
Expand Down Expand Up @@ -109,6 +110,8 @@ const OrganizationPage: NextPageWithOptions<InferGetServerSidePropsType<typeof g
}}
edit
/>
{/* eslint-disable-next-line i18next/no-literal-string */}
<LocationDrawer>Create new Location</LocationDrawer>
<Stack spacing={40} w='100%'>
{locations.map((location) => (
<LocationCard key={location.id} locationId={location.id} edit />
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/pages/search/[...params]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const SearchResults = () => {
<Link
external
variant={variants.Link.inheritStyle}
href='https://www.erininthemorning.com/p/anti-trans-legislative-risk-assessment-43a'
href='https://www.erininthemorning.com/p/anti-trans-legislative-risk-assessment-2a4'
target='_blank'
></Link>
),
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@
"dotenv": "16.4.5",
"dotenv-expand": "11.0.6",
"husky": "9.0.11",
"knip": "5.17.4",
"knip": "5.18.2",
"lint-staged": "15.2.5",
"prettier": "3.3.1",
"prettier-plugin-jsdoc": "1.3.0",
"prettier-plugin-packagejson": "2.5.0",
"prettier-plugin-prisma": "5.0.0",
"sherif": "0.8.4",
"tsx": "4.11.2",
"tsx": "4.15.1",
"turbo": "1.13.4",
"typescript": "5.4.5",
"typesync": "0.12.1",
"yargs": "17.7.2"
},
"packageManager": "pnpm@9.2.0",
"packageManager": "pnpm@9.3.0",
"engines": {
"node": "^20.12.2",
"pnpm": "^9.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@weareinreach/eslint-config": "workspace:*",
"next": "14.2.3",
"nextjs-google-analytics": "2.3.3",
"type-fest": "4.19.0"
"type-fest": "4.20.0"
},
"peerDependencies": {
"next": "14.2.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@googlemaps/google-maps-services-js": "3.4.0",
"@opentelemetry/api": "1.9.0",
"@sentry/nextjs": "7.116.0",
"@sentry/nextjs": "7.117.0",
"@tanstack/react-query": "4.36.1",
"@terraformer/wkt": "2.2.1",
"@trpc/client": "10.45.2",
Expand Down Expand Up @@ -46,7 +46,7 @@
"libphonenumber-js": "1.11.3",
"luxon": "3.4.4",
"nanoid": "5.0.7",
"remeda": "2.0.4",
"remeda": "2.0.9",
"slugify": "1.6.6",
"social-links": "1.14.0",
"tiny-invariant": "1.3.3",
Expand All @@ -69,7 +69,7 @@
"next": "14.2.3",
"prettier": "3.3.1",
"trpc-panel": "1.3.4",
"type-fest": "4.19.0",
"type-fest": "4.20.0",
"typescript": "5.4.5"
},
"peerDependencies": {
Expand Down
51 changes: 49 additions & 2 deletions packages/api/router/location/mutation.create.handler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,58 @@
import { getAuditedClient } from '@weareinreach/db'
import { createGeoFields, getAuditedClient, Prisma } from '@weareinreach/db'
import { createManyRequired } from '~api/schemas/nestedOps'
import { type TRPCHandlerParams } from '~api/types/handler'

import { type TCreateSchema } from './mutation.create.schema'

const create = async ({ ctx, input }: TRPCHandlerParams<TCreateSchema, 'protected'>) => {
const prisma = getAuditedClient(ctx.actorId)
const result = await prisma.orgLocation.create(input)
const { emails, phones, services, address, ...rest } = input
const serviceLinks = (
!services
? undefined
: createManyRequired(
services.map((serviceId) => {
return { serviceId }
})
)
) satisfies Prisma.OrgLocationServiceCreateNestedManyWithoutLocationInput | undefined

const emailLinks = (
!emails
? undefined
: createManyRequired(
emails.map((orgEmailId) => {
return { orgEmailId }
})
)
) satisfies Prisma.OrgLocationEmailCreateNestedManyWithoutLocationInput | undefined
const phoneLinks = (
!phones
? undefined
: createManyRequired(
phones.map((phoneId) => {
return { phoneId }
})
)
) satisfies Prisma.OrgLocationPhoneCreateNestedManyWithoutLocationInput | undefined
const addressData = address
? {
...address,
...createGeoFields({ longitude: address.longitude, latitude: address.latitude }),
}
: address

const createArgs = Prisma.validator<Prisma.OrgLocationCreateArgs>()({
data: {
...rest,
...addressData,
emails: emailLinks,
phones: phoneLinks,
services: serviceLinks,
},
})

const result = await prisma.orgLocation.create(createArgs)

return result
}
Expand Down
93 changes: 23 additions & 70 deletions packages/api/router/location/mutation.create.schema.ts
Original file line number Diff line number Diff line change
@@ -1,77 +1,30 @@
import { z } from 'zod'

import { createGeoFields, Prisma } from '@weareinreach/db'
import { prefixedId } from '~api/schemas/idPrefix'
import { createManyRequired } from '~api/schemas/nestedOps'

export const ZCreateSchema = z
.object({
orgId: prefixedId('organization'),
id: prefixedId('orgLocation').optional(),
name: z.string().optional(),
street1: z.string(),
street2: z.string().optional(),
city: z.string(),
postCode: z.string().optional(),
primary: z.boolean().optional(),
govDistId: z.string(),
countryId: z.string(),
longitude: z.number(),
latitude: z.number(),
published: z.boolean().default(false),
emails: z
.object({ orgEmailId: prefixedId('orgEmail') })
.array()
.optional(),
phones: z
.object({ phoneId: prefixedId('orgPhone') })
.array()
.optional(),
services: z
.object({ serviceId: prefixedId('orgService') })
.array()
.optional(),
})
.transform((data) => {
const { emails, phones, services, ...dataTo } = data
const serviceLinks = (
!services
? undefined
: createManyRequired(
services.map(({ serviceId }) => {
return { serviceId }
})
)
) satisfies Prisma.OrgLocationServiceCreateNestedManyWithoutLocationInput | undefined

const emailLinks = (
!emails
? undefined
: createManyRequired(
emails.map(({ orgEmailId }) => {
return { orgEmailId }
})
)
) satisfies Prisma.OrgLocationEmailCreateNestedManyWithoutLocationInput | undefined
const phoneLinks = (
!phones
? undefined
: createManyRequired(
phones.map(({ phoneId }) => {
return { phoneId }
})
)
) satisfies Prisma.OrgLocationPhoneCreateNestedManyWithoutLocationInput | undefined

return Prisma.validator<Prisma.OrgLocationCreateArgs>()({
data: {
...dataTo,
...createGeoFields({ longitude: dataTo.longitude, latitude: dataTo.latitude }),
emails: emailLinks,
phones: phoneLinks,
services: serviceLinks,
},
export const ZCreateSchema = z.object({
orgId: prefixedId('organization'),
id: prefixedId('orgLocation').optional(),
name: z.string(),
address: z
.object({
street1: z.string(),
street2: z.string().optional(),
city: z.string(),
postCode: z.string().optional(),
govDistId: z.string(),
longitude: z.number(),
latitude: z.number(),
countryId: z.string(),
})
})
.partial()
.required({ countryId: true }),
primary: z.boolean().optional(),
notVisitable: z.boolean().default(false),
published: z.boolean().default(false),
emails: prefixedId('orgEmail').array().optional(),
phones: prefixedId('orgPhone').array().optional(),
services: prefixedId('orgService').array().optional(),
})

export type TCreateSchema = z.infer<typeof ZCreateSchema>
2 changes: 1 addition & 1 deletion packages/api/router/location/mutation.update.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const ZUpdateSchema = z
name: z.string(),
street1: z.string().nullish(),
street2: z.string().nullish(),
city: z.string(),
city: z.string().nullish(),
postCode: z.string().nullable(),
primary: z.boolean(),
mailOnly: z.boolean(),
Expand Down
2 changes: 2 additions & 0 deletions packages/api/router/location/query.forLocationCard.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const forLocationCard = async ({ input, ctx }: TRPCHandlerParams<TForLocationCar
latitude: true,
longitude: true,
notVisitable: true,
published: true,
deleted: true,
country: { select: { cca2: true } },
govDist: { select: { abbrev: true, tsKey: true, tsNs: true } },
phones: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const forOrgPageEdits = async ({ input }: TRPCHandlerParams<TForOrgPageEditsSche
govDist: { select: { abbrev: true, tsKey: true, tsNs: true } },
notVisitable: true,
},
orderBy: [{ deleted: 'asc' }, { published: 'desc' }, { createdAt: 'desc' }],
},
attributes,
},
Expand Down
17 changes: 9 additions & 8 deletions packages/api/router/organization/query.searchDistance.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,15 @@ const prismaDistSearchDetails = async (input: TSearchDistanceSchema & { resultId
)

locations.forEach(({ services: locationServices, city, ...coords }) => {
cities.push({
city,
dist: getDistance(
{ latitude, longitude },
{ latitude: coords.latitude ?? 0, longitude: coords.longitude ?? 0 },
1000
),
})
city &&
cities.push({
city,
dist: getDistance(
{ latitude, longitude },
{ latitude: coords.latitude ?? 0, longitude: coords.longitude ?? 0 },
1000
),
})
locationServices.forEach(({ service }) =>
service.services.forEach(({ tag, service: innerService }) => {
const { id, tsKey, tsNs, primaryCategory } = tag
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
"with-env": "dotenv -e ../../.env --"
},
"dependencies": {
"@aws-sdk/client-cognito-identity-provider": "3.590.0",
"@aws-sdk/client-cognito-identity-provider": "3.592.0",
"@next-auth/prisma-adapter": "1.0.7",
"@weareinreach/db": "workspace:*",
"@weareinreach/env": "workspace:*",
"@weareinreach/util": "workspace:*",
"aws-jwt-verify": "4.0.1",
"tiny-invariant": "1.3.3",
"tslog": "4.9.2",
"tslog": "4.9.3",
"zod": "3.23.8"
},
"devDependencies": {
Expand Down
Loading

1 comment on commit 78aa297

@vercel
Copy link

@vercel vercel bot commented on 78aa297 Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.