Skip to content

Commit

Permalink
Does this build now?
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarendorff committed Jun 29, 2024
1 parent 23dc549 commit 17811c1
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/dist/exports/types.js b/dist/exports/types.js
index 2fe1b45aff53a41694b647c8cb1212e0edd6b014..1a82b4dd74a6dd5524f6c2ef856a5d68829005df 100644
--- a/dist/exports/types.js
+++ b/dist/exports/types.js
@@ -1,5 +1,5 @@
export { GraphQLJSON, GraphQLJSONObject } from '../packages/graphql-type-json/index.js';
export { buildPaginatedListType } from '../schema/buildPaginatedListType.js';
-export { default as GraphQL } from 'graphql';
+export * as GraphQL from 'graphql';

//# sourceMappingURL=types.js.map
\ No newline at end of file
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
],
"resolutions": {
"react-test-renderer": "18.2.0",
"ts-node": "10.9.1"
"ts-node": "10.9.1",
"@payloadcms/graphql@npm:3.0.0-beta.55": "patch:@payloadcms/graphql@npm%3A3.0.0-beta.55#~/.yarn/patches/@payloadcms-graphql-npm-3.0.0-beta.55-27e9ac4479.patch"
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion packages/web/src/app/(app)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const metadata: Metadata = {
const RootLayout = async ({children}: PropsWithChildren) => {
const user = await getCurrentUser();
// TODO figure out why I am not allowed to check with payload here...
const routes: NavLinkDefinition[] = [] /*await getNavRoutes()*/;
const routes: NavLinkDefinition[] = await getNavRoutes();

return (
<html lang='en' className={roboto.variable}>
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/app/(payload)/access/require-one-of.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {type GeneratedTypes,type FieldAccess, type TypeWithID} from 'payload';
import {type GeneratedTypes, type FieldAccess, type TypeWithID} from 'payload';
import {type SessionUser} from '../collections/users';

type Role = GeneratedTypes['collections']['users']['roles'][number];
Expand Down
23 changes: 14 additions & 9 deletions packages/web/src/app/(payload)/collections/groupchats.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import {type GeneratedTypes, type Payload, type CollectionConfig, type ValidateOptions} from 'payload';
import {
type GeneratedTypes,
type Payload,
type CollectionConfig,
type ValidateOptions,
} from 'payload';
import {type Groupchat, type GroupchatKeyword} from '../../../payload-types';
import {allowUpdateDeleteOwner} from '../access/allow-update-delete-owner';
import {requireOneOf} from '../access/require-one-of';
Expand Down Expand Up @@ -210,15 +215,15 @@ export const Groupchats: CollectionConfig = {
const keywords =
doc.keywords.length > 0
? await req.payload.find({
collection: 'groupchat-keywords',
where: {
id: {
in: doc.keywords.map((k: number | GroupchatKeyword) =>
typeof k === 'number' ? k : k.id,
),
collection: 'groupchat-keywords',
where: {
id: {
in: doc.keywords.map((k: number | GroupchatKeyword) =>
typeof k === 'number' ? k : k.id,
),
},
},
},
})
})
: {docs: []};

const {owners, ...sanitized} = doc;
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/app/(payload)/collections/users.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {type GeneratedTypes,type CollectionConfig} from 'payload';
import {type GeneratedTypes, type CollectionConfig} from 'payload';
import {hiddenUnlessOwner} from '../access/hidden-unless-owner';
import {requireOneOf} from '../access/require-one-of';
import {AuthState} from '../lib/auth-state';
import {ytfAuthStrategy} from '../lib/auth-strategy';
import {getAuthStateFromHeaders} from '../lib/get-auth-state-from-headers';
import { AuthState } from '../lib/auth-state';

export type PayloadUser = GeneratedTypes['collections']['users'];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import React, {type FC, useEffect, useState} from 'react';
import {AuthState} from "../../lib/auth-state";
import {AuthState} from '../../lib/auth-state';
import {AuthenticatedMishap} from './components/authenticated-mishap';
import {MissingAccess} from './components/missing-access';
import {MissingCookie} from './components/missing-cookie';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import {type GeneratedTypes,type Access, NotFound, type CollectionConfig, type PayloadRequest } from 'payload';
import {
type GeneratedTypes,
type Access,
NotFound,
type CollectionConfig,
type PayloadRequest,
} from 'payload';
import {type PayloadUser, toRequestUser} from '../../collections/users';
import {type QueryFactory} from '../../utils/merge-queries';

Expand Down
8 changes: 7 additions & 1 deletion packages/web/src/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ export interface Media {
export interface Groupchat {
id: number;
name: string;
platform: 'discord' | 'facebook' | 'instagram' | 'signal' | 'telegram' | 'whatsapp';
platform:
| 'discord'
| 'facebook'
| 'instagram'
| 'signal'
| 'telegram'
| 'whatsapp';
showUnauthenticated?: boolean | null;
description?: string | null;
url: string;
Expand Down
8 changes: 6 additions & 2 deletions packages/web/src/payload.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'path';
import {fileURLToPath} from 'url';
import {postgresAdapter} from '@payloadcms/db-postgres';
import {slateEditor} from '@payloadcms/richtext-slate';
import {PHASE_PRODUCTION_BUILD} from 'next/constants';
import {buildConfig, type Config} from 'payload';
import sharp from 'sharp';
import {Features} from './app/(payload)/collections/features';
Expand All @@ -14,13 +15,15 @@ import {setupCronJobs} from './app/(payload)/cron-jobs';
import {mimicUserOperationMutation} from './app/(payload)/graphql/mutations/mimic-user-operation';
import {groupchatSearchTokenQuery} from './app/(payload)/graphql/queries/groupchat-search-token';
import {mayOperateQuery} from './app/(payload)/graphql/queries/may-operate';
// import {ensureDbExists} from './app/(payload)/utils/ensure-db-exists';
import {ensureDbExists} from './app/(payload)/utils/ensure-db-exists';
import {mergeQueries} from './app/(payload)/utils/merge-queries';

const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

// await ensureDbExists();
if (process.env.NEXT_PHASE !== PHASE_PRODUCTION_BUILD) {
await ensureDbExists();
}

const config: Config = {
admin: {
Expand All @@ -30,6 +33,7 @@ const config: Config = {
},
},
onInit: async (payload) => {
if (process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD) return;
// TODO wait for drizzle to resolve this and run migrations prior to JS container
// https://github.com/drizzle-team/drizzle-orm/issues/819
// await payload.db.migrate();
Expand Down

0 comments on commit 17811c1

Please sign in to comment.