Merge branch 'alpha' of github.com:payloadcms/payload into alpha
This commit is contained in:
@@ -4,30 +4,30 @@ export const mediaSlug = 'media'
|
||||
|
||||
export const MediaCollection: CollectionConfig = {
|
||||
slug: mediaSlug,
|
||||
access: {
|
||||
create: () => true,
|
||||
read: () => true,
|
||||
},
|
||||
fields: [],
|
||||
upload: {
|
||||
crop: true,
|
||||
focalPoint: true,
|
||||
imageSizes: [
|
||||
{
|
||||
name: 'thumbnail',
|
||||
width: 200,
|
||||
height: 200,
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
name: 'medium',
|
||||
width: 800,
|
||||
height: 800,
|
||||
width: 800,
|
||||
},
|
||||
{
|
||||
name: 'large',
|
||||
width: 1200,
|
||||
height: 1200,
|
||||
width: 1200,
|
||||
},
|
||||
],
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
create: () => true,
|
||||
},
|
||||
fields: [],
|
||||
}
|
||||
|
||||
@@ -5,12 +5,10 @@ import { mediaSlug } from '../Media/index.js'
|
||||
export const postsSlug = 'posts'
|
||||
|
||||
export const PostsCollection: CollectionConfig = {
|
||||
slug: postsSlug,
|
||||
admin: {
|
||||
useAsTitle: 'text',
|
||||
},
|
||||
versions: {
|
||||
drafts: true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'text',
|
||||
@@ -27,12 +25,12 @@ export const PostsCollection: CollectionConfig = {
|
||||
},
|
||||
{
|
||||
name: 'associatedMedia',
|
||||
type: 'upload',
|
||||
access: {
|
||||
create: () => true,
|
||||
update: () => false,
|
||||
},
|
||||
relationTo: mediaSlug,
|
||||
type: 'upload',
|
||||
},
|
||||
{
|
||||
name: 'blocksField',
|
||||
@@ -42,12 +40,12 @@ export const PostsCollection: CollectionConfig = {
|
||||
slug: 'block1',
|
||||
fields: [
|
||||
{
|
||||
type: 'group',
|
||||
name: 'group1',
|
||||
type: 'group',
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'group1Text',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -56,5 +54,7 @@ export const PostsCollection: CollectionConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
slug: postsSlug,
|
||||
versions: {
|
||||
drafts: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export default buildConfigWithDefaults({
|
||||
const imageFilePath = path.resolve(process.cwd(), './test/uploads/image.png')
|
||||
const imageFile = await getFileByPath(imageFilePath)
|
||||
|
||||
const { id: uploadedImage } = await payload.create({
|
||||
await payload.create({
|
||||
collection: 'media',
|
||||
data: {},
|
||||
file: imageFile,
|
||||
|
||||
Reference in New Issue
Block a user