diff --git a/app/routes/_auth+/auth.$provider.callback.test.ts b/app/routes/_auth+/auth.$provider.callback.test.ts
index c6b44803..5c538e82 100644
--- a/app/routes/_auth+/auth.$provider.callback.test.ts
+++ b/app/routes/_auth+/auth.$provider.callback.test.ts
@@ -23,7 +23,7 @@ afterEach(async () => {
await deleteGitHubUsers()
})
-test('a new user goes to onboarding', async () => {
+test.skip('a new user goes to onboarding', async () => {
const request = await setupRequest()
const response = await loader({ request, params: PARAMS, context: {} }).catch(
e => e,
@@ -31,7 +31,7 @@ test('a new user goes to onboarding', async () => {
expect(response).toHaveRedirect('/onboarding/github')
})
-test('when auth fails, send the user to login with a toast', async () => {
+test.skip('when auth fails, send the user to login with a toast', async () => {
consoleError.mockImplementation(() => {})
server.use(
http.post('https://github.com/login/oauth/access_token', async () => {
@@ -53,7 +53,7 @@ test('when auth fails, send the user to login with a toast', async () => {
expect(consoleError).toHaveBeenCalledTimes(1)
})
-test('when a user is logged in, it creates the connection', async () => {
+test.skip('when a user is logged in, it creates the connection', async () => {
const githubUser = await insertGitHubUser()
const session = await setupUser()
const request = await setupRequest({
@@ -82,7 +82,7 @@ test('when a user is logged in, it creates the connection', async () => {
).toBeTruthy()
})
-test(`when a user is logged in and has already connected, it doesn't do anything and just redirects the user back to the connections page`, async () => {
+test.skip(`when a user is logged in and has already connected, it doesn't do anything and just redirects the user back to the connections page`, async () => {
const session = await setupUser()
const githubUser = await insertGitHubUser()
await prisma.connection.create({
@@ -106,7 +106,7 @@ test(`when a user is logged in and has already connected, it doesn't do anything
)
})
-test('when a user exists with the same email, create connection and make session', async () => {
+test.skip('when a user exists with the same email, create connection and make session', async () => {
const githubUser = await insertGitHubUser()
const email = githubUser.primaryEmail.toLowerCase()
const { userId } = await setupUser({ ...createUser(), email })
@@ -137,7 +137,7 @@ test('when a user exists with the same email, create connection and make session
await expect(response).toHaveSessionForUser(userId)
})
-test('gives an error if the account is already connected to another user', async () => {
+test.skip('gives an error if the account is already connected to another user', async () => {
const githubUser = await insertGitHubUser()
await prisma.user.create({
data: {
@@ -167,7 +167,7 @@ test('gives an error if the account is already connected to another user', async
)
})
-test('if a user is not logged in, but the connection exists, make a session', async () => {
+test.skip('if a user is not logged in, but the connection exists, make a session', async () => {
const githubUser = await insertGitHubUser()
const { userId } = await setupUser()
await prisma.connection.create({
@@ -183,7 +183,7 @@ test('if a user is not logged in, but the connection exists, make a session', as
await expect(response).toHaveSessionForUser(userId)
})
-test('if a user is not logged in, but the connection exists and they have enabled 2FA, send them to verify their 2FA and do not make a session', async () => {
+test.skip('if a user is not logged in, but the connection exists and they have enabled 2FA, send them to verify their 2FA and do not make a session', async () => {
const githubUser = await insertGitHubUser()
const { userId } = await setupUser()
await prisma.connection.create({
diff --git a/app/routes/_auth+/auth.$provider.callback.ts b/app/routes/_auth+/auth.$provider.callback.ts
index ceb52c69..806d94af 100644
--- a/app/routes/_auth+/auth.$provider.callback.ts
+++ b/app/routes/_auth+/auth.$provider.callback.ts
@@ -1,179 +1,162 @@
-import { redirect, type LoaderFunctionArgs } from '@remix-run/node'
-import {
- authenticator,
- getSessionExpirationDate,
- getUserId,
-} from '#app/utils/auth.server.ts'
-import { ProviderNameSchema, providerLabels } from '#app/utils/connections.tsx'
-import { prisma } from '#app/utils/db.server.ts'
-import { combineHeaders } from '#app/utils/misc.tsx'
-import {
- destroyRedirectToHeader,
- getRedirectCookieValue,
-} from '#app/utils/redirect-cookie.server.ts'
-import {
- createToastHeaders,
- redirectWithToast,
-} from '#app/utils/toast.server.ts'
-import { verifySessionStorage } from '#app/utils/verification.server.ts'
-import { handleNewSession } from './login.server.ts'
-import {
- onboardingEmailSessionKey,
- prefilledProfileKey,
- providerIdKey,
-} from './onboarding_.$provider.tsx'
+import { type LoaderFunctionArgs } from '@remix-run/node'
+import { redirectWithToast } from '#app/utils/toast.server.ts'
-const destroyRedirectTo = { 'set-cookie': destroyRedirectToHeader }
+// const destroyRedirectTo = { 'set-cookie': destroyRedirectToHeader }
export async function loader({ request, params }: LoaderFunctionArgs) {
- const providerName = ProviderNameSchema.parse(params.provider)
- const redirectTo = getRedirectCookieValue(request)
- const label = providerLabels[providerName]
+ return redirectWithToast('/', {
+ type: 'error',
+ title: 'Access Denied',
+ description: 'No new users at this time.',
+ })
+ // const providerName = ProviderNameSchema.parse(params.provider)
+ // const redirectTo = getRedirectCookieValue(request)
+ // const label = providerLabels[providerName]
- const authResult = await authenticator
- .authenticate(providerName, request, { throwOnError: true })
- .then(
- data => ({ success: true, data }) as const,
- error => ({ success: false, error }) as const,
- )
+ // const authResult = await authenticator
+ // .authenticate(providerName, request, { throwOnError: true })
+ // .then(
+ // data => ({ success: true, data }) as const,
+ // error => ({ success: false, error }) as const,
+ // )
- if (!authResult.success) {
- console.error(authResult.error)
- throw await redirectWithToast(
- '/login',
- {
- title: 'Auth Failed',
- description: `There was an error authenticating with ${label}.`,
- type: 'error',
- },
- { headers: destroyRedirectTo },
- )
- }
+ // if (!authResult.success) {
+ // console.error(authResult.error)
+ // throw await redirectWithToast(
+ // '/login',
+ // {
+ // title: 'Auth Failed',
+ // description: `There was an error authenticating with ${label}.`,
+ // type: 'error',
+ // },
+ // { headers: destroyRedirectTo },
+ // )
+ // }
- const { data: profile } = authResult
+ // const { data: profile } = authResult
- const existingConnection = await prisma.connection.findUnique({
- select: { userId: true },
- where: {
- providerName_providerId: { providerName, providerId: profile.id },
- },
- })
+ // const existingConnection = await prisma.connection.findUnique({
+ // select: { userId: true },
+ // where: {
+ // providerName_providerId: { providerName, providerId: profile.id },
+ // },
+ // })
- const userId = await getUserId(request)
+ // const userId = await getUserId(request)
- if (existingConnection && userId) {
- if (existingConnection.userId === userId) {
- return redirectWithToast(
- '/settings/profile/connections',
- {
- title: 'Already Connected',
- description: `Your "${profile.username}" ${label} account is already connected.`,
- },
- { headers: destroyRedirectTo },
- )
- } else {
- return redirectWithToast(
- '/settings/profile/connections',
- {
- title: 'Already Connected',
- description: `The "${profile.username}" ${label} account is already connected to another account.`,
- },
- { headers: destroyRedirectTo },
- )
- }
- }
+ // if (existingConnection && userId) {
+ // if (existingConnection.userId === userId) {
+ // return redirectWithToast(
+ // '/settings/profile/connections',
+ // {
+ // title: 'Already Connected',
+ // description: `Your "${profile.username}" ${label} account is already connected.`,
+ // },
+ // { headers: destroyRedirectTo },
+ // )
+ // } else {
+ // return redirectWithToast(
+ // '/settings/profile/connections',
+ // {
+ // title: 'Already Connected',
+ // description: `The "${profile.username}" ${label} account is already connected to another account.`,
+ // },
+ // { headers: destroyRedirectTo },
+ // )
+ // }
+ // }
- // If we're already logged in, then link the account
- if (userId) {
- await prisma.connection.create({
- data: {
- providerName,
- providerId: profile.id,
- userId,
- },
- })
- return redirectWithToast(
- '/settings/profile/connections',
- {
- title: 'Connected',
- type: 'success',
- description: `Your "${profile.username}" ${label} account has been connected.`,
- },
- { headers: destroyRedirectTo },
- )
- }
+ // // If we're already logged in, then link the account
+ // if (userId) {
+ // await prisma.connection.create({
+ // data: {
+ // providerName,
+ // providerId: profile.id,
+ // userId,
+ // },
+ // })
+ // return redirectWithToast(
+ // '/settings/profile/connections',
+ // {
+ // title: 'Connected',
+ // type: 'success',
+ // description: `Your "${profile.username}" ${label} account has been connected.`,
+ // },
+ // { headers: destroyRedirectTo },
+ // )
+ // }
- // Connection exists already? Make a new session
- if (existingConnection) {
- return makeSession({ request, userId: existingConnection.userId })
- }
+ // // Connection exists already? Make a new session
+ // if (existingConnection) {
+ // return makeSession({ request, userId: existingConnection.userId })
+ // }
- // if the email matches a user in the db, then link the account and
- // make a new session
- const user = await prisma.user.findUnique({
- select: { id: true },
- where: { email: profile.email.toLowerCase() },
- })
- if (user) {
- await prisma.connection.create({
- data: {
- providerName,
- providerId: profile.id,
- userId: user.id,
- },
- })
- return makeSession(
- { request, userId: user.id },
- {
- headers: await createToastHeaders({
- title: 'Connected',
- description: `Your "${profile.username}" ${label} account has been connected.`,
- }),
- },
- )
- }
+ // // if the email matches a user in the db, then link the account and
+ // // make a new session
+ // const user = await prisma.user.findUnique({
+ // select: { id: true },
+ // where: { email: profile.email.toLowerCase() },
+ // })
+ // if (user) {
+ // await prisma.connection.create({
+ // data: {
+ // providerName,
+ // providerId: profile.id,
+ // userId: user.id,
+ // },
+ // })
+ // return makeSession(
+ // { request, userId: user.id },
+ // {
+ // headers: await createToastHeaders({
+ // title: 'Connected',
+ // description: `Your "${profile.username}" ${label} account has been connected.`,
+ // }),
+ // },
+ // )
+ // }
- // this is a new user, so let's get them onboarded
- const verifySession = await verifySessionStorage.getSession()
- verifySession.set(onboardingEmailSessionKey, profile.email)
- verifySession.set(prefilledProfileKey, {
- ...profile,
- email: profile.email.toLowerCase(),
- username: profile.username?.replace(/[^a-zA-Z0-9_]/g, '_').toLowerCase(),
- })
- verifySession.set(providerIdKey, profile.id)
- const onboardingRedirect = [
- `/onboarding/${providerName}`,
- redirectTo ? new URLSearchParams({ redirectTo }) : null,
- ]
- .filter(Boolean)
- .join('?')
- return redirect(onboardingRedirect, {
- headers: combineHeaders(
- { 'set-cookie': await verifySessionStorage.commitSession(verifySession) },
- destroyRedirectTo,
- ),
- })
+ // // this is a new user, so let's get them onboarded
+ // const verifySession = await verifySessionStorage.getSession()
+ // verifySession.set(onboardingEmailSessionKey, profile.email)
+ // verifySession.set(prefilledProfileKey, {
+ // ...profile,
+ // email: profile.email.toLowerCase(),
+ // username: profile.username?.replace(/[^a-zA-Z0-9_]/g, '_').toLowerCase(),
+ // })
+ // verifySession.set(providerIdKey, profile.id)
+ // const onboardingRedirect = [
+ // `/onboarding/${providerName}`,
+ // redirectTo ? new URLSearchParams({ redirectTo }) : null,
+ // ]
+ // .filter(Boolean)
+ // .join('?')
+ // return redirect(onboardingRedirect, {
+ // headers: combineHeaders(
+ // { 'set-cookie': await verifySessionStorage.commitSession(verifySession) },
+ // destroyRedirectTo,
+ // ),
+ // })
}
-async function makeSession(
- {
- request,
- userId,
- redirectTo,
- }: { request: Request; userId: string; redirectTo?: string | null },
- responseInit?: ResponseInit,
-) {
- redirectTo ??= '/'
- const session = await prisma.session.create({
- select: { id: true, expirationDate: true, userId: true },
- data: {
- expirationDate: getSessionExpirationDate(),
- userId,
- },
- })
- return handleNewSession(
- { request, session, redirectTo, remember: true },
- { headers: combineHeaders(responseInit?.headers, destroyRedirectTo) },
- )
-}
+// async function makeSession(
+// {
+// request,
+// userId,
+// redirectTo,
+// }: { request: Request; userId: string; redirectTo?: string | null },
+// responseInit?: ResponseInit,
+// ) {
+// redirectTo ??= '/'
+// const session = await prisma.session.create({
+// select: { id: true, expirationDate: true, userId: true },
+// data: {
+// expirationDate: getSessionExpirationDate(),
+// userId,
+// },
+// })
+// return handleNewSession(
+// { request, session, redirectTo, remember: true },
+// { headers: combineHeaders(responseInit?.headers, destroyRedirectTo) },
+// )
+// }
diff --git a/app/routes/_auth+/login.tsx b/app/routes/_auth+/login.tsx
index 42a01b94..548d898b 100644
--- a/app/routes/_auth+/login.tsx
+++ b/app/routes/_auth+/login.tsx
@@ -15,10 +15,6 @@ import { CheckboxField, ErrorList, Field } from '#app/components/forms.tsx'
import { Spacer } from '#app/components/spacer.tsx'
import { StatusButton } from '#app/components/ui/status-button.tsx'
import { login, requireAnonymous } from '#app/utils/auth.server.ts'
-import {
- ProviderConnectionForm,
- providerNames,
-} from '#app/utils/connections.tsx'
import { validateCSRF } from '#app/utils/csrf.server.ts'
import { checkHoneypot } from '#app/utils/honeypot.server.ts'
import { useIsPending } from '#app/utils/misc.tsx'
@@ -174,29 +170,6 @@ export default function LoginPage() {
-
- {providerNames.map(providerName => (
- -
-
-
- ))}
-
-
- New here?
-
- Create an account
-
-
diff --git a/app/routes/_auth+/onboarding_.$provider.tsx b/app/routes/_auth+/onboarding_.$provider.tsx
index e275a0d7..b07200fc 100644
--- a/app/routes/_auth+/onboarding_.$provider.tsx
+++ b/app/routes/_auth+/onboarding_.$provider.tsx
@@ -1,5 +1,4 @@
-import { conform, useForm } from '@conform-to/react'
-import { getFieldsetConstraint, parse } from '@conform-to/zod'
+import { parse } from '@conform-to/zod'
import {
json,
redirect,
@@ -7,27 +6,16 @@ import {
type ActionFunctionArgs,
type MetaFunction,
} from '@remix-run/node'
-import {
- Form,
- useActionData,
- useLoaderData,
- useSearchParams,
- type Params,
-} from '@remix-run/react'
+import { type Params } from '@remix-run/react'
import { safeRedirect } from 'remix-utils/safe-redirect'
import { z } from 'zod'
-import { CheckboxField, ErrorList, Field } from '#app/components/forms.tsx'
-import { Spacer } from '#app/components/spacer.tsx'
-import { StatusButton } from '#app/components/ui/status-button.tsx'
import {
- authenticator,
requireAnonymous,
sessionKey,
signupWithConnection,
} from '#app/utils/auth.server.ts'
import { ProviderNameSchema } from '#app/utils/connections.tsx'
import { prisma } from '#app/utils/db.server.ts'
-import { useIsPending } from '#app/utils/misc.tsx'
import { authSessionStorage } from '#app/utils/session.server.ts'
import { redirectWithToast } from '#app/utils/toast.server.ts'
import { NameSchema, UsernameSchema } from '#app/utils/user-validation.ts'
@@ -77,28 +65,33 @@ async function requireData({
}
export async function loader({ request, params }: LoaderFunctionArgs) {
- const { email } = await requireData({ request, params })
- const authSession = await authSessionStorage.getSession(
- request.headers.get('cookie'),
- )
- const verifySession = await verifySessionStorage.getSession(
- request.headers.get('cookie'),
- )
- const prefilledProfile = verifySession.get(prefilledProfileKey)
+ return redirectWithToast('/', {
+ type: 'error',
+ title: 'Access Denied',
+ description: 'No new users at this time.',
+ })
+ // const { email } = await requireData({ request, params })
+ // const authSession = await authSessionStorage.getSession(
+ // request.headers.get('cookie'),
+ // )
+ // const verifySession = await verifySessionStorage.getSession(
+ // request.headers.get('cookie'),
+ // )
+ // const prefilledProfile = verifySession.get(prefilledProfileKey)
- const formError = authSession.get(authenticator.sessionErrorKey)
+ // const formError = authSession.get(authenticator.sessionErrorKey)
- return json({
- email,
- status: 'idle',
- submission: {
- intent: '',
- payload: (prefilledProfile ?? {}) as Record,
- error: {
- '': typeof formError === 'string' ? [formError] : [],
- },
- },
- })
+ // return json({
+ // email,
+ // status: 'idle',
+ // submission: {
+ // intent: '',
+ // payload: (prefilledProfile ?? {}) as Record,
+ // error: {
+ // '': typeof formError === 'string' ? [formError] : [],
+ // },
+ // },
+ // })
}
export async function action({ request, params }: ActionFunctionArgs) {
@@ -173,108 +166,108 @@ export const meta: MetaFunction = () => {
return [{ title: 'Setup Epic Notes Account' }]
}
-export default function SignupRoute() {
- const data = useLoaderData()
- const actionData = useActionData()
- const isPending = useIsPending()
- const [searchParams] = useSearchParams()
- const redirectTo = searchParams.get('redirectTo')
+// export default function SignupRoute() {
+// const data = useLoaderData()
+// const actionData = useActionData()
+// const isPending = useIsPending()
+// const [searchParams] = useSearchParams()
+// const redirectTo = searchParams.get('redirectTo')
- const [form, fields] = useForm({
- id: 'onboarding-provider-form',
- constraint: getFieldsetConstraint(SignupFormSchema),
- lastSubmission: actionData?.submission ?? data.submission,
- onValidate({ formData }) {
- return parse(formData, { schema: SignupFormSchema })
- },
- shouldRevalidate: 'onBlur',
- })
+// const [form, fields] = useForm({
+// id: 'onboarding-provider-form',
+// constraint: getFieldsetConstraint(SignupFormSchema),
+// lastSubmission: actionData?.submission ?? data.submission,
+// onValidate({ formData }) {
+// return parse(formData, { schema: SignupFormSchema })
+// },
+// shouldRevalidate: 'onBlur',
+// })
- return (
-
-
-
-
Welcome aboard {data.email}!
-
- Please enter your details.
-
-
-
-
+//
+//
+// )
+// }
diff --git a/app/routes/_auth+/signup.tsx b/app/routes/_auth+/signup.tsx
index 815e2f19..0d5c80fc 100644
--- a/app/routes/_auth+/signup.tsx
+++ b/app/routes/_auth+/signup.tsx
@@ -23,6 +23,7 @@ import { prisma } from '#app/utils/db.server.ts'
import { sendEmail } from '#app/utils/email.server.ts'
import { checkHoneypot } from '#app/utils/honeypot.server.ts'
import { useIsPending } from '#app/utils/misc.tsx'
+import { redirectWithToast } from '#app/utils/toast.server.ts'
import { EmailSchema } from '#app/utils/user-validation.ts'
import { prepareVerification } from './verify.server.ts'
@@ -30,6 +31,14 @@ const SignupSchema = z.object({
email: EmailSchema,
})
+export async function loader() {
+ return redirectWithToast('/', {
+ type: 'error',
+ title: 'Access Denied',
+ description: 'No new users at this time.',
+ })
+}
+
export async function action({ request }: ActionFunctionArgs) {
const formData = await request.formData()
diff --git a/app/routes/_marketing+/about.tsx b/app/routes/_marketing+/about.tsx
index 55ef96d8..aa64c6aa 100644
--- a/app/routes/_marketing+/about.tsx
+++ b/app/routes/_marketing+/about.tsx
@@ -1,3 +1,9 @@
+import { redirect } from '@remix-run/react'
+
+export async function loader() {
+ return redirect('/')
+}
+
export default function AboutRoute() {
return About page
}
diff --git a/app/routes/_marketing+/privacy.tsx b/app/routes/_marketing+/privacy.tsx
index b6d65309..c51749fc 100644
--- a/app/routes/_marketing+/privacy.tsx
+++ b/app/routes/_marketing+/privacy.tsx
@@ -1,3 +1,9 @@
+import { redirect } from '@remix-run/react'
+
+export async function loader() {
+ return redirect('/')
+}
+
export default function PrivacyRoute() {
return Privacy
}
diff --git a/app/routes/_marketing+/support.tsx b/app/routes/_marketing+/support.tsx
index ec9a2420..b02c3e4a 100644
--- a/app/routes/_marketing+/support.tsx
+++ b/app/routes/_marketing+/support.tsx
@@ -1,3 +1,9 @@
+import { redirect } from '@remix-run/react'
+
+export async function loader() {
+ return redirect('/')
+}
+
export default function SupportRoute() {
return Support
}
diff --git a/app/routes/_marketing+/tos.tsx b/app/routes/_marketing+/tos.tsx
index 998f867b..405988b3 100644
--- a/app/routes/_marketing+/tos.tsx
+++ b/app/routes/_marketing+/tos.tsx
@@ -1,3 +1,9 @@
+import { redirect } from '@remix-run/react'
+
+export async function loader() {
+ return redirect('/')
+}
+
export default function TermsOfServiceRoute() {
return Terms of service
}
diff --git a/app/routes/resources+/api.v1+/artwork-branch.create.tsx b/app/routes/resources+/api.v1+/artwork-branch.create.tsx
index 16e6e4c2..c834426e 100644
--- a/app/routes/resources+/api.v1+/artwork-branch.create.tsx
+++ b/app/routes/resources+/api.v1+/artwork-branch.create.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher, useNavigate } from '@remix-run/react'
import { useEffect, useState } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -34,6 +38,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_BRANCH.CREATE
const schema = NewArtworkBranchSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.create.tsx b/app/routes/resources+/api.v1+/artwork-version.create.tsx
index bb915c11..318b81d3 100644
--- a/app/routes/resources+/api.v1+/artwork-version.create.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.create.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher, useNavigate, useParams } from '@remix-run/react'
import { useEffect, useState } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -36,6 +40,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.CREATE
const schema = NewArtworkVersionSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.design.create.tsx b/app/routes/resources+/api.v1+/artwork-version.design.create.tsx
index bddce00b..41a9d0a6 100644
--- a/app/routes/resources+/api.v1+/artwork-version.design.create.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.design.create.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.DESIGN.CREATE
const schema = NewArtworkVersionDesignSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.design.delete.tsx b/app/routes/resources+/api.v1+/artwork-version.design.delete.tsx
index 1e33ddb4..474c0edd 100644
--- a/app/routes/resources+/api.v1+/artwork-version.design.delete.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.design.delete.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.DESIGN.DELETE
const schema = DeleteArtworkVersionDesignSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.design.update.order.tsx b/app/routes/resources+/api.v1+/artwork-version.design.update.order.tsx
index d29e484a..f7ef47a0 100644
--- a/app/routes/resources+/api.v1+/artwork-version.design.update.order.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.design.update.order.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.DESIGN.UPDATE.ORDER
const schema = ReorderArtworkVersionDesignSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.design.update.visible.tsx b/app/routes/resources+/api.v1+/artwork-version.design.update.visible.tsx
index c1786562..9dede3c7 100644
--- a/app/routes/resources+/api.v1+/artwork-version.design.update.visible.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.design.update.visible.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.DESIGN.UPDATE.VISIBLE
const schema = ToggleVisibleArtworkVersionDesignSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.layer.create.tsx b/app/routes/resources+/api.v1+/artwork-version.layer.create.tsx
index 68579639..38a34b2f 100644
--- a/app/routes/resources+/api.v1+/artwork-version.layer.create.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.layer.create.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -21,6 +25,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.LAYER.CREATE
const schema = NewArtworkVersionLayerSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.layer.delete.tsx b/app/routes/resources+/api.v1+/artwork-version.layer.delete.tsx
index 682a07be..f3f7ae71 100644
--- a/app/routes/resources+/api.v1+/artwork-version.layer.delete.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.layer.delete.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -23,6 +27,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.LAYER.DELETE
const schema = DeleteArtworkVersionLayerSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.layer.update.order.tsx b/app/routes/resources+/api.v1+/artwork-version.layer.update.order.tsx
index 8a95ade0..f8ec9a19 100644
--- a/app/routes/resources+/api.v1+/artwork-version.layer.update.order.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.layer.update.order.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.LAYER.UPDATE.ORDER
const schema = ReorderArtworkVersionLayerSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.layer.update.selected.tsx b/app/routes/resources+/api.v1+/artwork-version.layer.update.selected.tsx
index 25a7596b..4e2dbcee 100644
--- a/app/routes/resources+/api.v1+/artwork-version.layer.update.selected.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.layer.update.selected.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.LAYER.UPDATE.SELECTED
const schema = SelectArtworkVersionLayerSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.layer.update.visible.tsx b/app/routes/resources+/api.v1+/artwork-version.layer.update.visible.tsx
index 99972b8f..58555806 100644
--- a/app/routes/resources+/api.v1+/artwork-version.layer.update.visible.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.layer.update.visible.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.LAYER.UPDATE.VISIBLE
const schema = ToggleVisibleArtworkVersionLayerSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.update.background.tsx b/app/routes/resources+/api.v1+/artwork-version.update.background.tsx
index 59f109e0..18825445 100644
--- a/app/routes/resources+/api.v1+/artwork-version.update.background.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.update.background.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -19,6 +23,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.UPDATE.BACKGROUND
const schema = ArtworkVersionBackgroundSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.update.height.tsx b/app/routes/resources+/api.v1+/artwork-version.update.height.tsx
index ac0026df..f694dbdb 100644
--- a/app/routes/resources+/api.v1+/artwork-version.update.height.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.update.height.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -21,6 +25,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.UPDATE.WIDTH
const schema = ArtworkVersionHeightSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/artwork-version.update.width.tsx b/app/routes/resources+/api.v1+/artwork-version.update.width.tsx
index 32142ff9..b2c319f4 100644
--- a/app/routes/resources+/api.v1+/artwork-version.update.width.tsx
+++ b/app/routes/resources+/api.v1+/artwork-version.update.width.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -21,6 +25,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.ARTWORK_VERSION.UPDATE.WIDTH
const schema = ArtworkVersionWidthSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.fill.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.fill.update.basis.tsx
index d268f4e7..6ac5b046 100644
--- a/app/routes/resources+/api.v1+/design.type.fill.update.basis.tsx
+++ b/app/routes/resources+/api.v1+/design.type.fill.update.basis.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -31,6 +35,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.FILL.UPDATE.BASIS
const schema = EditDesignFillBasisSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.fill.update.style.tsx b/app/routes/resources+/api.v1+/design.type.fill.update.style.tsx
index 522d2d23..e23ffea2 100644
--- a/app/routes/resources+/api.v1+/design.type.fill.update.style.tsx
+++ b/app/routes/resources+/api.v1+/design.type.fill.update.style.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -31,6 +35,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.FILL.UPDATE.STYLE
const schema = EditDesignFillStyleSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.fill.update.value.tsx b/app/routes/resources+/api.v1+/design.type.fill.update.value.tsx
index 450fc232..2792cce3 100644
--- a/app/routes/resources+/api.v1+/design.type.fill.update.value.tsx
+++ b/app/routes/resources+/api.v1+/design.type.fill.update.value.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.FILL.UPDATE.VALUE
const schema = EditDesignFillValueSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.layout.update.columns.tsx b/app/routes/resources+/api.v1+/design.type.layout.update.columns.tsx
index fddcfbba..b3f93fd8 100644
--- a/app/routes/resources+/api.v1+/design.type.layout.update.columns.tsx
+++ b/app/routes/resources+/api.v1+/design.type.layout.update.columns.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.LAYOUT.UPDATE.COLUMNS
const schema = EditDesignLayoutColumnsSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.layout.update.count.tsx b/app/routes/resources+/api.v1+/design.type.layout.update.count.tsx
index 957e38c6..a0ff6e94 100644
--- a/app/routes/resources+/api.v1+/design.type.layout.update.count.tsx
+++ b/app/routes/resources+/api.v1+/design.type.layout.update.count.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.LAYOUT.UPDATE.COUNT
const schema = EditDesignLayoutCountSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.layout.update.rows.tsx b/app/routes/resources+/api.v1+/design.type.layout.update.rows.tsx
index c77e6696..4df926c4 100644
--- a/app/routes/resources+/api.v1+/design.type.layout.update.rows.tsx
+++ b/app/routes/resources+/api.v1+/design.type.layout.update.rows.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.LAYOUT.UPDATE.ROWS
const schema = EditDesignLayoutRowsSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.layout.update.style.tsx b/app/routes/resources+/api.v1+/design.type.layout.update.style.tsx
index 73e85ae6..8f85ea19 100644
--- a/app/routes/resources+/api.v1+/design.type.layout.update.style.tsx
+++ b/app/routes/resources+/api.v1+/design.type.layout.update.style.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -34,6 +38,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.LAYOUT.UPDATE.STYLE
const schema = EditDesignLayoutStyleSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.line.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.line.update.basis.tsx
index e1f0a6af..0710b545 100644
--- a/app/routes/resources+/api.v1+/design.type.line.update.basis.tsx
+++ b/app/routes/resources+/api.v1+/design.type.line.update.basis.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -31,6 +35,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.LINE.UPDATE.BASIS
const schema = EditDesignLineBasisSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.line.update.format.tsx b/app/routes/resources+/api.v1+/design.type.line.update.format.tsx
index b6b738f2..a3fbb0e0 100644
--- a/app/routes/resources+/api.v1+/design.type.line.update.format.tsx
+++ b/app/routes/resources+/api.v1+/design.type.line.update.format.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -34,6 +38,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.LINE.UPDATE.FORMAT
const schema = EditDesignLineFormatSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.line.update.width.tsx b/app/routes/resources+/api.v1+/design.type.line.update.width.tsx
index 658f7d9f..0227e903 100644
--- a/app/routes/resources+/api.v1+/design.type.line.update.width.tsx
+++ b/app/routes/resources+/api.v1+/design.type.line.update.width.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.LINE.UPDATE.WIDTH
const schema = EditDesignLineWidthSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.palette.update.value.tsx b/app/routes/resources+/api.v1+/design.type.palette.update.value.tsx
index 1b2c9aa1..20dce8cd 100644
--- a/app/routes/resources+/api.v1+/design.type.palette.update.value.tsx
+++ b/app/routes/resources+/api.v1+/design.type.palette.update.value.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.PALETTE.UPDATE.VALUE
const schema = EditDesignPaletteValueSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.rotate.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.rotate.update.basis.tsx
index b64e4a34..20449e39 100644
--- a/app/routes/resources+/api.v1+/design.type.rotate.update.basis.tsx
+++ b/app/routes/resources+/api.v1+/design.type.rotate.update.basis.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -34,6 +38,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.ROTATE.UPDATE.BASIS
const schema = EditDesignRotateBasisSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.rotate.update.value.tsx b/app/routes/resources+/api.v1+/design.type.rotate.update.value.tsx
index 41c6e7ec..f9d98761 100644
--- a/app/routes/resources+/api.v1+/design.type.rotate.update.value.tsx
+++ b/app/routes/resources+/api.v1+/design.type.rotate.update.value.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.ROTATE.UPDATE.VALUE
const schema = EditDesignRotateValueSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.size.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.size.update.basis.tsx
index b8a2ef00..74f4599c 100644
--- a/app/routes/resources+/api.v1+/design.type.size.update.basis.tsx
+++ b/app/routes/resources+/api.v1+/design.type.size.update.basis.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -31,6 +35,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.SIZE.UPDATE.BASIS
const schema = EditDesignSizeBasisSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.size.update.format.tsx b/app/routes/resources+/api.v1+/design.type.size.update.format.tsx
index 40647862..57b92fad 100644
--- a/app/routes/resources+/api.v1+/design.type.size.update.format.tsx
+++ b/app/routes/resources+/api.v1+/design.type.size.update.format.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -34,6 +38,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.SIZE.UPDATE.FORMAT
const schema = EditDesignSizeFormatSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.size.update.value.tsx b/app/routes/resources+/api.v1+/design.type.size.update.value.tsx
index ecbdf121..47bdef76 100644
--- a/app/routes/resources+/api.v1+/design.type.size.update.value.tsx
+++ b/app/routes/resources+/api.v1+/design.type.size.update.value.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.SIZE.UPDATE.VALUE
const schema = EditDesignSizeValueSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.stroke.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.stroke.update.basis.tsx
index 5bc00422..8f996e90 100644
--- a/app/routes/resources+/api.v1+/design.type.stroke.update.basis.tsx
+++ b/app/routes/resources+/api.v1+/design.type.stroke.update.basis.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -34,6 +38,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.STROKE.UPDATE.BASIS
const schema = EditDesignStrokeBasisSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.stroke.update.style.tsx b/app/routes/resources+/api.v1+/design.type.stroke.update.style.tsx
index fa0ae104..45f1ac77 100644
--- a/app/routes/resources+/api.v1+/design.type.stroke.update.style.tsx
+++ b/app/routes/resources+/api.v1+/design.type.stroke.update.style.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -34,6 +38,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.STROKE.UPDATE.STYLE
const schema = EditDesignStrokeStyleSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.stroke.update.value.tsx b/app/routes/resources+/api.v1+/design.type.stroke.update.value.tsx
index ade27717..e555ad1e 100644
--- a/app/routes/resources+/api.v1+/design.type.stroke.update.value.tsx
+++ b/app/routes/resources+/api.v1+/design.type.stroke.update.value.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.STROKE.UPDATE.VALUE
const schema = EditDesignStrokeValueSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/design.type.template.update.style.tsx b/app/routes/resources+/api.v1+/design.type.template.update.style.tsx
index 369bc141..ebae6771 100644
--- a/app/routes/resources+/api.v1+/design.type.template.update.style.tsx
+++ b/app/routes/resources+/api.v1+/design.type.template.update.style.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -34,6 +38,11 @@ import { transformEntityEnumValueForSelect } from '#app/utils/string-formatting'
const route = Routes.RESOURCES.API.V1.DESIGN.TYPE.TEMPLATE.UPDATE.STYLE
const schema = EditDesignTemplateStyleSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/layer.design.create.tsx b/app/routes/resources+/api.v1+/layer.design.create.tsx
index cbb74f86..1d83fd66 100644
--- a/app/routes/resources+/api.v1+/layer.design.create.tsx
+++ b/app/routes/resources+/api.v1+/layer.design.create.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.LAYER.DESIGN.CREATE
const schema = NewLayerDesignSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/layer.design.delete.tsx b/app/routes/resources+/api.v1+/layer.design.delete.tsx
index c887a226..a47be558 100644
--- a/app/routes/resources+/api.v1+/layer.design.delete.tsx
+++ b/app/routes/resources+/api.v1+/layer.design.delete.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.LAYER.DESIGN.DELETE
const schema = DeleteLayerDesignSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/layer.design.update.order.tsx b/app/routes/resources+/api.v1+/layer.design.update.order.tsx
index 2c57da34..0764d62f 100644
--- a/app/routes/resources+/api.v1+/layer.design.update.order.tsx
+++ b/app/routes/resources+/api.v1+/layer.design.update.order.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -24,6 +28,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.LAYER.DESIGN.UPDATE.ORDER
const schema = ReorderLayerDesignSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
@@ -42,11 +51,11 @@ export async function action({ request }: ActionFunctionArgs) {
? await layerDesignMoveUpService({
userId,
...submission.value,
- })
+ })
: await layerDesignMoveDownService({
userId,
...submission.value,
- })
+ })
updateSuccess = success
}
diff --git a/app/routes/resources+/api.v1+/layer.design.update.visible.tsx b/app/routes/resources+/api.v1+/layer.design.update.visible.tsx
index 447e14ae..57a148cf 100644
--- a/app/routes/resources+/api.v1+/layer.design.update.visible.tsx
+++ b/app/routes/resources+/api.v1+/layer.design.update.visible.tsx
@@ -1,6 +1,10 @@
import { useForm } from '@conform-to/react'
import { getFieldsetConstraint } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
import { redirectBack } from 'remix-utils/redirect-back'
@@ -22,6 +26,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.LAYER.DESIGN.UPDATE.VISIBLE
const schema = ToggleVisibleLayerDesignSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/layer.update.description.tsx b/app/routes/resources+/api.v1+/layer.update.description.tsx
index f587d04b..c94d069e 100644
--- a/app/routes/resources+/api.v1+/layer.update.description.tsx
+++ b/app/routes/resources+/api.v1+/layer.update.description.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -23,6 +27,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.LAYER.UPDATE.DESCRIPTION
const schema = EditLayerDescriptionSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/resources+/api.v1+/layer.update.name.tsx b/app/routes/resources+/api.v1+/layer.update.name.tsx
index 84cbb3e2..2926c91f 100644
--- a/app/routes/resources+/api.v1+/layer.update.name.tsx
+++ b/app/routes/resources+/api.v1+/layer.update.name.tsx
@@ -1,6 +1,10 @@
import { conform, useForm } from '@conform-to/react'
import { getFieldsetConstraint, parse } from '@conform-to/zod'
-import { json, type ActionFunctionArgs } from '@remix-run/node'
+import {
+ json,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+} from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import { useRef } from 'react'
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
@@ -23,6 +27,11 @@ import { Routes } from '#app/utils/routes.const'
const route = Routes.RESOURCES.API.V1.LAYER.UPDATE.NAME
const schema = EditLayerNameSchema
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+ return json({})
+}
+
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const formData = await request.formData()
diff --git a/app/routes/users+/$username.test.tsx b/app/routes/users+/$username.test.tsx
index 55f14de8..62a0a93a 100644
--- a/app/routes/users+/$username.test.tsx
+++ b/app/routes/users+/$username.test.tsx
@@ -13,7 +13,7 @@ import { authSessionStorage } from '#app/utils/session.server.ts'
import { createUser, getUserImages } from '#tests/db-utils.ts'
import { default as UsernameRoute, loader } from './$username.tsx'
-test('The user profile when not logged in as self', async () => {
+test.skip('The user profile when not logged in as self', async () => {
const userImages = await getUserImages()
const userImage =
userImages[faker.number.int({ min: 0, max: userImages.length - 1 })]
@@ -37,7 +37,7 @@ test('The user profile when not logged in as self', async () => {
await screen.findByRole('link', { name: `${user.name}'s notes` })
})
-test('The user profile when logged in as self', async () => {
+test.skip('The user profile when logged in as self', async () => {
const userImages = await getUserImages()
const userImage =
userImages[faker.number.int({ min: 0, max: userImages.length - 1 })]
diff --git a/app/routes/users+/$username.tsx b/app/routes/users+/$username.tsx
index 6b91d1fb..90f09296 100644
--- a/app/routes/users+/$username.tsx
+++ b/app/routes/users+/$username.tsx
@@ -5,11 +5,14 @@ import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { Spacer } from '#app/components/spacer.tsx'
import { Button } from '#app/components/ui/button.tsx'
import { Icon } from '#app/components/ui/icon.tsx'
+import { requireUserId } from '#app/utils/auth.server'
import { prisma } from '#app/utils/db.server.ts'
import { getUserImgSrc } from '#app/utils/misc.tsx'
import { useOptionalUser } from '#app/utils/user.ts'
-export async function loader({ params }: LoaderFunctionArgs) {
+export async function loader({ params, request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+
const user = await prisma.user.findFirst({
select: {
id: true,
diff --git a/app/routes/users+/$username_+/artworks+/components.tsx b/app/routes/users+/$username_+/artworks+/__components.tsx
similarity index 100%
rename from app/routes/users+/$username_+/artworks+/components.tsx
rename to app/routes/users+/$username_+/artworks+/__components.tsx
diff --git a/app/routes/users+/$username_+/artworks+/route.tsx b/app/routes/users+/$username_+/artworks+/route.tsx
index b9938f39..0cd9315a 100644
--- a/app/routes/users+/$username_+/artworks+/route.tsx
+++ b/app/routes/users+/$username_+/artworks+/route.tsx
@@ -10,15 +10,18 @@ import {
SideNavWrapper,
} from '#app/components/shared'
import { Separator } from '#app/components/ui/separator'
+import { requireUserId } from '#app/utils/auth.server'
import { type BreadcrumbHandle } from '#app/utils/breadcrumbs'
import { prisma } from '#app/utils/db.server.ts'
-import { Breadcrumbs, Header, List } from './components'
+import { Breadcrumbs, Header, List } from './__components'
export const handle: BreadcrumbHandle = {
breadcrumb: () => 'Artworks',
}
-export async function loader({ params }: LoaderFunctionArgs) {
+export async function loader({ params, request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+
const owner = await prisma.user.findFirst({
select: {
id: true,
diff --git a/app/routes/users+/$username_+/layers+/components.tsx b/app/routes/users+/$username_+/layers+/__components.tsx
similarity index 100%
rename from app/routes/users+/$username_+/layers+/components.tsx
rename to app/routes/users+/$username_+/layers+/__components.tsx
diff --git a/app/routes/users+/$username_+/layers+/route.tsx b/app/routes/users+/$username_+/layers+/route.tsx
index 74566782..930232ba 100644
--- a/app/routes/users+/$username_+/layers+/route.tsx
+++ b/app/routes/users+/$username_+/layers+/route.tsx
@@ -10,15 +10,18 @@ import {
SideNavWrapper,
} from '#app/components/shared'
import { Separator } from '#app/components/ui/separator'
+import { requireUserId } from '#app/utils/auth.server'
import { type BreadcrumbHandle } from '#app/utils/breadcrumbs'
import { prisma } from '#app/utils/db.server.ts'
-import { Breadcrumbs, Header, List } from './components'
+import { Breadcrumbs, Header, List } from './__components'
export const handle: BreadcrumbHandle = {
breadcrumb: () => 'Layers',
}
-export async function loader({ params }: LoaderFunctionArgs) {
+export async function loader({ params, request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+
const owner = await prisma.user.findFirst({
select: {
id: true,
diff --git a/app/routes/users+/$username_+/notes.tsx b/app/routes/users+/$username_+/notes.tsx
index 465620a1..de48477f 100644
--- a/app/routes/users+/$username_+/notes.tsx
+++ b/app/routes/users+/$username_+/notes.tsx
@@ -3,11 +3,14 @@ import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, NavLink, Outlet, useLoaderData } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { Icon } from '#app/components/ui/icon.tsx'
+import { requireUserId } from '#app/utils/auth.server'
import { prisma } from '#app/utils/db.server.ts'
import { cn, getUserImgSrc } from '#app/utils/misc.tsx'
import { useOptionalUser } from '#app/utils/user.ts'
-export async function loader({ params }: LoaderFunctionArgs) {
+export async function loader({ params, request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+
const owner = await prisma.user.findFirst({
select: {
id: true,
diff --git a/app/routes/users+/$username_+/projects+/components.tsx b/app/routes/users+/$username_+/projects+/__components.tsx
similarity index 100%
rename from app/routes/users+/$username_+/projects+/components.tsx
rename to app/routes/users+/$username_+/projects+/__components.tsx
diff --git a/app/routes/users+/$username_+/projects+/route.tsx b/app/routes/users+/$username_+/projects+/route.tsx
index 6545dd56..2b64c29e 100644
--- a/app/routes/users+/$username_+/projects+/route.tsx
+++ b/app/routes/users+/$username_+/projects+/route.tsx
@@ -10,15 +10,18 @@ import {
SideNavWrapper,
} from '#app/components/shared'
import { Separator } from '#app/components/ui/separator'
+import { requireUserId } from '#app/utils/auth.server'
import { type BreadcrumbHandle } from '#app/utils/breadcrumbs'
import { prisma } from '#app/utils/db.server.ts'
-import { Breadcrumbs, Header, List } from './components'
+import { Breadcrumbs, Header, List } from './__components'
export const handle: BreadcrumbHandle = {
breadcrumb: () => 'Projects',
}
-export async function loader({ params }: LoaderFunctionArgs) {
+export async function loader({ params, request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+
const owner = await prisma.user.findFirst({
select: {
id: true,
diff --git a/app/routes/users+/index.tsx b/app/routes/users+/index.tsx
index fb2a3f02..c0fb8c15 100644
--- a/app/routes/users+/index.tsx
+++ b/app/routes/users+/index.tsx
@@ -4,6 +4,7 @@ import { z } from 'zod'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { ErrorList } from '#app/components/forms.tsx'
import { SearchBar } from '#app/components/search-bar.tsx'
+import { requireUserId } from '#app/utils/auth.server'
import { prisma } from '#app/utils/db.server.ts'
import { cn, getUserImgSrc, useDelayedIsPending } from '#app/utils/misc.tsx'
@@ -17,6 +18,8 @@ const UserSearchResultSchema = z.object({
const UserSearchResultsSchema = z.array(UserSearchResultSchema)
export async function loader({ request }: LoaderFunctionArgs) {
+ await requireUserId(request)
+
const searchTerm = new URL(request.url).searchParams.get('search')
if (searchTerm === '') {
return redirect('/users')
diff --git a/app/utils/auth.server.ts b/app/utils/auth.server.ts
index e80b1f5a..911dfa16 100644
--- a/app/utils/auth.server.ts
+++ b/app/utils/auth.server.ts
@@ -130,9 +130,7 @@ export async function signup({
email: email.toLowerCase(),
username: username.toLowerCase(),
name,
- roles: {
- connect: [{ name: 'admin' }, { name: 'user' }],
- },
+ roles: { connect: { name: 'user' } },
password: {
create: {
hash: hashedPassword,
diff --git a/tests/e2e/onboarding.test.ts b/tests/e2e/onboarding.test.ts
index e0cb2ee9..2ba2045f 100644
--- a/tests/e2e/onboarding.test.ts
+++ b/tests/e2e/onboarding.test.ts
@@ -33,7 +33,27 @@ const test = base.extend<{
},
})
-test('onboarding with link', async ({ page, getOnboardingData }) => {
+test('onboarding not allowed', async ({ page, login }) => {
+ await page.goto('/')
+
+ // no login link
+ const loginLink = page.getByRole('link', { name: /log in/i })
+ await expect(loginLink).not.toBeVisible()
+
+ await page.goto('/login')
+
+ // no create account link
+ const createAccountLink = page.getByRole('link', {
+ name: /create an account/i,
+ })
+ await expect(createAccountLink).not.toBeVisible()
+
+ // signup page redirects to home
+ await page.goto('/signup')
+ await expect(page).toHaveURL(`/`)
+})
+
+test.skip('onboarding with link', async ({ page, getOnboardingData }) => {
const onboardingData = getOnboardingData()
await page.goto('/')
@@ -104,7 +124,10 @@ test('onboarding with link', async ({ page, getOnboardingData }) => {
await expect(page).toHaveURL(`/`)
})
-test('onboarding with a short code', async ({ page, getOnboardingData }) => {
+test.skip('onboarding with a short code', async ({
+ page,
+ getOnboardingData,
+}) => {
const onboardingData = getOnboardingData()
await page.goto('/signup')