Skip to content

Commit

Permalink
Merge pull request #31 from ilyasbozdemir/case-project
Browse files Browse the repository at this point in the history
Case project
  • Loading branch information
ilyasbozdemir authored May 2, 2024
2 parents 5d1e4b6 + 0a3194e commit ac17ab5
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ public record AuthorDTO : BaseAuditableDTO<Guid>
public DateTime BirthDate { get; set; }
public string Country { get; set; }
public string Biography { get; set; }
public string Website { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ public record CreateAuthorDTO : BaseAuditableDTO<Guid>
public DateTime BirthDate { get; set; }
public string Country { get; set; }
public string Biography { get; set; }
public string Website { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,15 @@ public async Task<CreateAuthorCommandResponse> Handle(CreateAuthorCommandRequest
Country = request.Country,
BirthDate = request.BirthDate,
Biography = request.Biography,
Website = request.Website,
IsDeleted = false,
CreatedById = Guid.NewGuid(),//staff id olucak ilerde
LastModifiedById = Guid.NewGuid(),//staff id olucak ilerde
LastModifiedDateUnix = BaseEntity.ToUnixTimestamp(DateTime.Now),
CreatedDateUnix = BaseEntity.ToUnixTimestamp(DateTime.Now),
};

var bookDto = new AuthorDTO()
{
Name = request.Name,
Surname = request.Surname,
Country = request.Country,
BirthDate = request.BirthDate,
Biography = request.Biography,
};


var writeRepository = _unitOfWork.GetWriteRepository<Domain.Entities.Library.Author>();
bool isAdded = await writeRepository.AddAsync(newAuthor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public class CreateAuthorCommandRequest : IRequest<CreateAuthorCommandResponse>
public DateTime BirthDate { get; set; }
public string Country { get; set; }
public string Biography { get; set; }
public string Website { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ bunlar her handler'de kullanılcaktır.
Biography = author.Biography,
BirthDate = author.BirthDate,
Country = author.Country,
Website=author.Website,
}).ToList();

_cache.Set(cacheKey, authorDtoList, TimeSpan.FromMinutes(5));
Expand Down
4 changes: 2 additions & 2 deletions LibraryTrackingApp/src/frontend/constants/appSidebarItems.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ export const sidebarItems = [
{
icon: <IoCreateOutline />,
title: "Yeni Ekle",
href: "book-tag/new",
href: "/app/book-tag/new",
target: "_self",
},
{
icon: <BsArrowLeftRight />,
title: "Etiketleri Listele",
href: "book-tag",
href: "/app/book-tag",
target: "_self",
},
],
Expand Down
23 changes: 23 additions & 0 deletions LibraryTrackingApp/src/frontend/constants/meSidebarItems.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@ import {
FaClock,
FaExchangeAlt,
FaHistory,
FaList,
FaQuestionCircle,
FaStar,
FaUser,
FaUsers,
} from "react-icons/fa";
import { FiHome } from "react-icons/fi";

export const meSidebarItems = [
{
title: "Ana Sayfa",
icon: <FiHome />,
href: "/me",
target: "_self",
},
{
title: "Profil Yönetimi",
icon: <FaUser />,
Expand Down Expand Up @@ -37,6 +46,20 @@ export const meSidebarItems = [
target: "_self",
subItems: [],
},
{
title: "Favoriler",
icon: <FaStar />,
href: "/me/favorites",
target: "_self",
subItems: [],
},
{
title: "Okuma Listesi",
icon: <FaList />,
href: "/me/reading-list",
target: "_self",
subItems: [],
},
{
title: "Destek",
icon: <FaQuestionCircle />,
Expand Down
5 changes: 3 additions & 2 deletions LibraryTrackingApp/src/frontend/pages/_app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import dynamic from "next/dynamic";

const AnonLayout = dynamic(() => import("@/layouts/Anon/layout"));
const AppLayout = dynamic(() => import("@/layouts/App/layout"));
const MeLayout = dynamic(() => import("@/layouts/Me/layout"));
const AdminLayout = dynamic(() => import("@/layouts/Admin/layout"));
const PlaceholderLayout = dynamic(() =>
import("@/layouts/Placeholder/layout")
);



import { useColorMode, colorMode } from "@chakra-ui/react";

import "../styles/globals.css";
Expand All @@ -33,10 +32,12 @@ function MyApp({ Component, pageProps, session, statusCode }) {
const anonLayoutRoutes = ["/./"];
const adminLayoutRoutes = /^\/admin(?:\/|$)/;
const appLayoutRoutes = /^\/app(?:\/|$)/;
const meLayoutRoutes = /^\/me(?:\/|$)/;

const routeLayoutMap = [
{ regex: adminLayoutRoutes, layout: AdminLayout },
{ regex: appLayoutRoutes, layout: AppLayout },
{ regex: meLayoutRoutes, layout: MeLayout },
{
regex: new RegExp(`^(${placeholderRoutes.join("|")})`),
layout: PlaceholderLayout,
Expand Down
27 changes: 27 additions & 0 deletions LibraryTrackingApp/src/frontend/pages/me/favorites.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from "react";
import { Container, Heading, List, ListItem, Text } from "@chakra-ui/react";

const FavoritesPage = () => {
const favorites = [
{ id: 1, title: "Harry Potter and the Philosopher's Stone", author: "J.K. Rowling" },
{ id: 2, title: "To Kill a Mockingbird", author: "Harper Lee" },
{ id: 3, title: "1984", author: "George Orwell" },

];

return (
<Container maxW="xl">
<Heading as="h1" mb={4}>Favoriler</Heading>
<List spacing={3}>
{favorites.map((item) => (
<ListItem key={item.id}>
<Text fontSize="lg" fontWeight="bold">{item.title}</Text>
<Text>{item.author}</Text>
</ListItem>
))}
</List>
</Container>
);
};

export default FavoritesPage;
112 changes: 106 additions & 6 deletions LibraryTrackingApp/src/frontend/pages/me/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,109 @@
import React from 'react'
import React from "react";

import {
Flex,
Box,
Heading,
Text,
Button,
IconButton,
Spacer,
Stack,
Divider,
Avatar,
AvatarBadge,
HStack,
} from "@chakra-ui/react";
import { FiSettings, FiLogOut } from "react-icons/fi";
import { FaRegHeart, FaRegListAlt } from "react-icons/fa";

const IndexPage = () => {

const user = {
name: "İlyas Bozdemir",
username: "İlyas Bozdemir",
email: "user@example.com",
avatar: "https://avatars.githubusercontent.com/u/52322835?s=96&v=4",
role: "Üye",
status: "Aktif",
bio: "Merhaba, ben İlyas. Kitap okumayı çok seviyorum ve bu platformda yeni kitaplar keşfetmeyi umuyorum.",
};

function IndexPage() {
return (
<div>IndexPage</div>
)
}
<Flex p={4}>
<Box w="25%">
<Avatar name={user.name} size="xl" src={user.avatar}>
<AvatarBadge boxSize="1.25em" bg="green.500" />
</Avatar>
<Heading as="h3" mt={4} mb={2} fontSize="xl">
{user.username}
</Heading>
<Text color="gray.500">Premium Üye</Text>
<Flex justify="center" align="center" mt={4}>
<Button leftIcon={<FiSettings />} colorScheme="teal">
Profili Düzenle
</Button>
<IconButton
ml={3}
aria-label="Çıkış Yap"
icon={<FiLogOut />}
colorScheme="red"
/>
</Flex>

</Box>
<Spacer />
<Box w="50%" borderWidth="1px" borderRadius="md" p={4}>
<Heading as="h3" mb={4} fontSize="xl">
Favori Kitaplar
</Heading>
<Stack spacing={2}>
<Box>
<Text fontWeight="bold">1. Harry Potter ve Felsefe Taşı</Text>
<Text color="gray.500">J.K. Rowling</Text>
</Box>
<Divider />
<Box>
<Text fontWeight="bold">2. Hobbit</Text>
<Text color="gray.500">J.R.R. Tolkien</Text>
</Box>
<Divider />
<Box>
<Text fontWeight="bold">3. Suç ve Ceza</Text>
<Text color="gray.500">Fyodor Dostoyevski</Text>
</Box>
</Stack>
<Button mt={4} leftIcon={<FaRegHeart />} colorScheme="teal">
Tüm Favorileri Görüntüle
</Button>
</Box>
<Spacer />
<Box w="25%" borderWidth="1px" borderRadius="md" p={4}>
<Heading as="h3" mb={4} fontSize="xl">
Okuma Listesi
</Heading>
<Stack spacing={2}>
<Box>
<Text fontWeight="bold">1. Uyanış</Text>
<Text color="gray.500">Leo Tolstoy</Text>
</Box>
<Divider />
<Box>
<Text fontWeight="bold">2. 1984</Text>
<Text color="gray.500">George Orwell</Text>
</Box>
<Divider />
<Box>
<Text fontWeight="bold">3. Uçurtma Avcısı</Text>
<Text color="gray.500">Khaled Hosseini</Text>
</Box>
</Stack>
<Button mt={4} leftIcon={<FaRegListAlt />} colorScheme="teal">
Tümünü Görüntüle
</Button>
</Box>
</Flex>
);
};

export default IndexPage
export default IndexPage;
27 changes: 27 additions & 0 deletions LibraryTrackingApp/src/frontend/pages/me/reading-list.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from "react";
import { Container, Heading, List, ListItem, Text } from "@chakra-ui/react";

const ReadingListPage = () => {
const readingList = [
{ id: 1, title: "The Great Gatsby", author: "F. Scott Fitzgerald" },
{ id: 2, title: "Pride and Prejudice", author: "Jane Austen" },
{ id: 3, title: "The Catcher in the Rye", author: "J.D. Salinger" },

];

return (
<Container maxW="xl">
<Heading as="h1" mb={4}>Okuma Listesi</Heading>
<List spacing={3}>
{readingList.map((item) => (
<ListItem key={item.id}>
<Text fontSize="lg" fontWeight="bold">{item.title}</Text>
<Text>{item.author}</Text>
</ListItem>
))}
</List>
</Container>
);
};

export default ReadingListPage;

0 comments on commit ac17ab5

Please sign in to comment.