Skip to content

Commit

Permalink
feat: dev to posts imported
Browse files Browse the repository at this point in the history
  • Loading branch information
Derlys committed Jan 30, 2024
1 parent 3adf4ba commit c90074a
Show file tree
Hide file tree
Showing 7 changed files with 702 additions and 7 deletions.
12 changes: 12 additions & 0 deletions libs/api/core/data-access/src/lib/api-core-provision-data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { faker } from '@faker-js/faker'
import { IdentityProvider, Prisma, Token, UserRole, UserStatus } from '@prisma/client'
import { slugifyId } from './helpers/slugify-id'
import { postDerlys } from './provision-data/derlys-dev-to'

const prices = [
//
Expand All @@ -16,6 +17,11 @@ export const provisionUsers: Prisma.UserCreateInput[] = [
avatarUrl: 'https://avatars.githubusercontent.com/u/58484607?v=4',
posts: {
create: [
...postDerlys.map((post) => ({
...post,
updatedAt: post.createdAt,
prices: { create: prices },
})),
{ title: 'Derlys Post 1', content: 'Hola!!', prices: { create: prices } },
{ title: 'Derlys Post 2', content: 'Hola!!', prices: { create: prices } },
{ title: 'Derlys Post 3', content: 'Hola!!', prices: { create: prices } },
Expand All @@ -35,6 +41,12 @@ export const provisionUsers: Prisma.UserCreateInput[] = [
developer: true,
posts: {
create: [
...postDerlys.map((post) => ({
...post,
title: `${post.title} (Alice)`,
updatedAt: post.createdAt,
prices: { create: prices },
})),
{ title: 'Alice Post 1', content: 'Hola from Alice!!' },
{ title: 'Alice Post 2', content: 'Hola from Alice!!' },
{ title: 'Alice Post 3', content: 'Hola from Alice!!' },
Expand Down
102 changes: 102 additions & 0 deletions libs/api/core/data-access/src/lib/provision-data/derlys-dev-to.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libs/web/settings/feature/src/lib/settings-feature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function SettingsFeature() {
}

return (
<UiContainer size="lg">
<UiContainer>
<UiGrid
sidebar={
<UserUiProfile
Expand Down
2 changes: 1 addition & 1 deletion libs/web/user/feature/src/lib/user-detail-feature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function UserDetailFeature() {
const isAuthUser = authUser?.id === user.id

return (
<UiContainer size="lg">
<UiContainer>
<UiGrid
sidebar={
<UserUiProfile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Button, Group } from '@mantine/core'
import { useMemo } from 'react'
import { UserProcessPostPayment } from './user-process-post-payment'
import { PostUiItem } from '@connectamind/web-post-ui'
import Markdown from 'react-markdown'

export function UserDetailPostDetailFeature({ username }: { username: string }) {
const { user } = useAuth()
Expand Down Expand Up @@ -56,7 +57,7 @@ export function UserDetailPostDetailFeature({ username }: { username: string })
<UiCard>
<PostUiItem post={item} />

{item.content ? <pre>{item.content}</pre> : null}
{item.content ? <Markdown>{item.content}</Markdown> : null}
</UiCard>

{!userIsAuthor ? (
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"prisma-extension-pagination": "^0.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-markdown": "^9.0.1",
"react-router-dom": "6.21.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
Expand Down
Loading

0 comments on commit c90074a

Please sign in to comment.