-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from NIAEFEUP/feature/payload-setup
Database and payload setup
- Loading branch information
Showing
19 changed files
with
13,376 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PAYLOAD_SECRET=jawliejfilwajefSEANlawefawfewag349jwgo3gj4d | ||
POSTGRES_URL=postgresql://postgres:<your-password>@127.0.0.1:5432/<database-name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules/ | ||
.next/ | ||
.next/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ | ||
import type { Metadata } from 'next' | ||
|
||
import config from '@payload-config' | ||
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ | ||
import { NotFoundPage, generatePageMetadata } from '@payloadcms/next/views' | ||
|
||
type Args = { | ||
params: { | ||
segments: string[] | ||
} | ||
searchParams: { | ||
[key: string]: string | string[] | ||
} | ||
} | ||
|
||
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> => | ||
generatePageMetadata({ config, params, searchParams }) | ||
|
||
const NotFound = ({ params, searchParams }: Args) => NotFoundPage({ config, params, searchParams }) | ||
|
||
export default NotFound |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ | ||
import type { Metadata } from 'next' | ||
|
||
import config from '@payload-config' | ||
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ | ||
import { RootPage, generatePageMetadata } from '@payloadcms/next/views' | ||
|
||
type Args = { | ||
params: { | ||
segments: string[] | ||
} | ||
searchParams: { | ||
[key: string]: string | string[] | ||
} | ||
} | ||
|
||
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> => | ||
generatePageMetadata({ config, params, searchParams }) | ||
|
||
const Page = ({ params, searchParams }: Args) => RootPage({ config, params, searchParams }) | ||
|
||
export default Page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ | ||
/* DO NOT MODIFY it because it could be re-written at any time. */ | ||
import config from '@payload-config' | ||
import { REST_DELETE, REST_GET, REST_OPTIONS, REST_PATCH, REST_POST } from '@payloadcms/next/routes' | ||
|
||
export const GET = REST_GET(config) | ||
export const POST = REST_POST(config) | ||
export const DELETE = REST_DELETE(config) | ||
export const PATCH = REST_PATCH(config) | ||
export const OPTIONS = REST_OPTIONS(config) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ | ||
import configPromise from '@payload-config' | ||
import '@payloadcms/next/css' | ||
import { RootLayout } from '@payloadcms/next/layouts' | ||
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ | ||
import React from 'react' | ||
|
||
import './custom.scss' | ||
|
||
type Args = { | ||
children: React.ReactNode | ||
} | ||
|
||
const Layout = ({ children }: Args) => <RootLayout config={configPromise}>{children}</RootLayout> | ||
|
||
export default Layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import configPromise from '@payload-config' | ||
import { getPayload } from 'payload' | ||
|
||
export const GET = async () => { | ||
const payload = await getPayload({ | ||
config: configPromise, | ||
}) | ||
|
||
const data = await payload.find({ | ||
collection: 'users', | ||
}) | ||
|
||
return Response.json(data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { CollectionConfig } from 'payload' | ||
|
||
export const Media: CollectionConfig = { | ||
slug: 'media', | ||
access: { | ||
read: () => true, | ||
}, | ||
fields: [ | ||
{ | ||
name: 'alt', | ||
type: 'text', | ||
required: true, | ||
}, | ||
], | ||
upload: true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { CollectionConfig } from 'payload' | ||
|
||
export const Users: CollectionConfig = { | ||
slug: 'users', | ||
admin: { | ||
useAsTitle: 'email', | ||
}, | ||
auth: true, | ||
fields: [ | ||
// Email added by default | ||
// Add more fields as needed | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* This file was automatically generated by Payload. | ||
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, | ||
* and re-run `payload generate:types` to regenerate this file. | ||
*/ | ||
|
||
export interface Config { | ||
auth: { | ||
users: UserAuthOperations; | ||
}; | ||
collections: { | ||
users: User; | ||
media: Media; | ||
'payload-preferences': PayloadPreference; | ||
'payload-migrations': PayloadMigration; | ||
}; | ||
db: { | ||
defaultIDType: number; | ||
}; | ||
globals: {}; | ||
locale: null; | ||
user: User & { | ||
collection: 'users'; | ||
}; | ||
} | ||
export interface UserAuthOperations { | ||
forgotPassword: { | ||
email: string; | ||
}; | ||
login: { | ||
email: string; | ||
password: string; | ||
}; | ||
registerFirstUser: { | ||
email: string; | ||
password: string; | ||
}; | ||
unlock: { | ||
email: string; | ||
}; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "users". | ||
*/ | ||
export interface User { | ||
id: number; | ||
updatedAt: string; | ||
createdAt: string; | ||
email: string; | ||
resetPasswordToken?: string | null; | ||
resetPasswordExpiration?: string | null; | ||
salt?: string | null; | ||
hash?: string | null; | ||
loginAttempts?: number | null; | ||
lockUntil?: string | null; | ||
password?: string | null; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "media". | ||
*/ | ||
export interface Media { | ||
id: number; | ||
alt: string; | ||
updatedAt: string; | ||
createdAt: string; | ||
url?: string | null; | ||
thumbnailURL?: string | null; | ||
filename?: string | null; | ||
mimeType?: string | null; | ||
filesize?: number | null; | ||
width?: number | null; | ||
height?: number | null; | ||
focalX?: number | null; | ||
focalY?: number | null; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "payload-preferences". | ||
*/ | ||
export interface PayloadPreference { | ||
id: number; | ||
user: { | ||
relationTo: 'users'; | ||
value: number | User; | ||
}; | ||
key?: string | null; | ||
value?: | ||
| { | ||
[k: string]: unknown; | ||
} | ||
| unknown[] | ||
| string | ||
| number | ||
| boolean | ||
| null; | ||
updatedAt: string; | ||
createdAt: string; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "payload-migrations". | ||
*/ | ||
export interface PayloadMigration { | ||
id: number; | ||
name?: string | null; | ||
batch?: number | null; | ||
updatedAt: string; | ||
createdAt: string; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "auth". | ||
*/ | ||
export interface Auth { | ||
[k: string]: unknown; | ||
} | ||
|
||
|
||
declare module 'payload' { | ||
export interface GeneratedTypes extends Config {} | ||
} |
Oops, something went wrong.