Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 | import { IArticle } from '../../../../shared'; import { createArticlePermissions } from '../../../../shared/permissions'; import { IArticleCreate } from '../../../../shared/types/article'; import { isAuthorized } from '../../../api/cognito'; import createArticle from '../../../articles/createArticle'; import GraphQLCreateArticle from '../inputs/CreateArticle'; import GraphQLArticle from '../outputs/Article'; // const loremIpsum = require('lorem-ipsum'); // const getRandomFromArray = (arr: any[]) => (arr[Math.floor(Math.random()*arr.length)]) export default { type: GraphQLArticle, args: { data: { type: GraphQLCreateArticle, }, }, resolve: async ( parent: any, { data }: { data: IArticleCreate }, request: Request, ): Promise<IArticle> => { isAuthorized(request, createArticlePermissions); // for (let i = 1; i < 1000; i = i + 1) { // const title = loremIpsum({ count: 6, units: 'words' }); // const text = loremIpsum({ count: 5, units: 'paragraphs' }); // const type = getRandomFromArray([ArticleTypes.zakulisi, ArticleTypes.prehledy, ArticleTypes.recenze]); // const category = type === ArticleTypes.recenze ? getRandomFromArray(["5c39abe8d2159826193fd7e8", "5c39abecd2159826193fd7e9", "5c39abf1d2159826193fd7ea", "5c39abf9d2159826193fd7eb", "5c39abfed2159826193fd7ec", "5c39ac0bd2159826193fd7ed", "5c39ac15d2159826193fd7ee"]) : undefined; // await createArticle({ ...data, title, text, category, type, image: `https://picsum.photos/1200/480?image=${i}` }); // } return createArticle(data); }, }; |