/
ProductImage.ts
38 lines (34 loc) · 1.08 KB
/
ProductImage.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { list } from '@keystone-6/core';
import { allowAll } from '@keystone-6/core/access';
import { relationship, text } from '@keystone-6/core/fields';
import 'dotenv/config';
// import { isSignedIn, permissions } from '../access';
import { cloudinaryImage } from '@keystone-6/cloudinary';
const ProductImage = list({
// access: {
// create: isSignedIn,
// read: () => true,
// update: permissions.canManageProducts,
// delete: permissions.canManageProducts,
// },
access: allowAll,
fields: {
image: cloudinaryImage({
cloudinary: {
cloudName: process.env.CLOUDINARY_CLOUD_NAME || "",
apiKey: process.env.CLOUDINARY_KEY || "",
apiSecret: process.env.CLOUDINARY_SECRET || "",
folder: '3rd-shop',
},
label: 'Source',
}),
altText: text(),
product: relationship({ ref: 'Product.photo' }),
},
ui: {
listView: {
initialColumns: ['image', 'altText', 'product'],
},
},
});
export default ProductImage