Compare commits

...

171 Commits

Author SHA1 Message Date
louiscklaw
b80939c78d update eslint to disable export sorting, 2025-06-18 10:54:30 +08:00
louiscklaw
779984f65c feat: enhance party user authentication endpoint with improved error handling, logging, and PartyUser model integration 2025-06-18 10:52:00 +08:00
louiscklaw
8bb6c9e992 update FAQ, 2025-06-18 10:39:57 +08:00
louiscklaw
60ecca48b4 feat: update workspace settings with font size configuration and recommended extensions 2025-06-18 10:32:12 +08:00
louiscklaw
7a6014a115 feat: implement event joining flow with dummy payment page, including route configuration, Redux state management, and UI updates for event detail page 2025-06-18 04:06:16 +08:00
louiscklaw
37ace98e60 feat: add party payment flow with dummy pay page implementation and route configuration 2025-06-18 02:32:09 +08:00
louiscklaw
44091e0432 feat: add party user gender field to schema and implement event joining functionality with gender tracking 2025-06-18 02:28:29 +08:00
louiscklaw
279496ea38 feat: remove AppRoute component and adjust related route configurations 2025-06-18 02:18:18 +08:00
louiscklaw
a450747670 feat: add new pages for event detail, member profile and order detail with corresponding route configurations 2025-06-18 01:20:27 +08:00
louiscklaw
215476cfaa feat: add party user metadata storage and display support, including storage API, Redux actions, state management, and UI updates for profile page 2025-06-18 01:14:37 +08:00
louiscklaw
c93b31b2f6 feat: implement party user authentication system with signin/signup routes, JWT token validation, and frontend integration including mobile route configuration and API service updates 2025-06-18 01:14:05 +08:00
louiscklaw
4cf93f431e feat: refine Account model schema with consistent formatting and add default rank field to PartyUser model 2025-06-18 00:23:12 +08:00
louiscklaw
2b09261f0a feat: implement login and signup pages with shared authentication styles, including form validation and Redux integration for authentication state management 2025-06-17 23:47:18 +08:00
louiscklaw
1325a361dc feat: update requirement REQ0188 dependencies, add frontend/party-user-auth/trunk to development paths 2025-06-17 22:11:45 +08:00
louiscklaw
a4d0d8b746 feat: clarify FAQ guidance on updating git staged files, adding reference to sibling files in same directory 2025-06-17 20:15:57 +08:00
louiscklaw
f8919b8c84 feat: update FAQ with guidance on updating git staged files, specifying to preserve format and detail level while avoiding unintended code changes 2025-06-17 20:12:39 +08:00
louiscklaw
583e31fd4d feat: refactor party event action types and functions, update imports and naming conventions to use PartyEvent naming scheme, add createPartyUser function to party-user actions 2025-06-17 20:06:47 +08:00
louiscklaw
ae7f005236 feat: enhance party user schema with address fields, update frontend form and API calls to use PartyUser naming convention 2025-06-17 19:59:09 +08:00
louiscklaw
834f9360ba feat: update import path for UserCreateView to use party-user view module 2025-06-17 19:58:56 +08:00
louiscklaw
1cb018d4d5 "feat: simplify db push script by removing restart loop and directly executing db:push and seed" 2025-06-17 19:58:45 +08:00
louiscklaw
448825545e "feat: refactor party user data fetching to use new endpoint URL builder and implement 2025-06-17 19:18:21 +08:00
louiscklaw
7c7a532381 fix: disable i18n debug mode in production 2025-06-17 19:18:13 +08:00
louiscklaw
eb515dbe68 feat: enhance party user schema with company, status, role and verification fields, update seeding and frontend form 2025-06-17 18:31:20 +08:00
louiscklaw
7a793be610 feat: update imports and component structure in party-user list view 2025-06-17 18:31:07 +08:00
louiscklaw
1d89134ea2 fix: remove unused tax calculation code in product form 2025-06-17 18:30:30 +08:00
louiscklaw
44d324b40e feat: update frontend references from User to PartyUser for party user management module 2025-06-16 10:20:09 +08:00
louiscklaw
ee2a377bf6 feat: add frontend environment variables template with server URL, API keys and service configurations 2025-06-16 10:20:01 +08:00
louiscklaw
0941ab6dd1 feat: update frontend component names from User to PartyUser for consistency with party-user module 2025-06-16 10:08:43 +08:00
louiscklaw
e93c5dcf62 in the middle of party-user frontend, 2025-06-16 03:03:54 +08:00
louiscklaw
17aaf97722 feat: add REQ0188 frontend party-user CRUD functionality with backend API endpoints and database schema 2025-06-16 02:26:41 +08:00
louiscklaw
47660be0cd docs: update FAQ with question about introducing new format or ideas 2025-06-16 02:24:47 +08:00
louiscklaw
cf5cfb8d63 "feat: add mobile app support with Dockerfile and dev/build scripts, update all projects to use psmisc for process management" 2025-06-16 01:46:15 +08:00
louiscklaw
a686dd55dd feat: update REQ0187 requirements with TODO items for nav bar cleanup and status change implementation 2025-06-16 00:36:37 +08:00
louiscklaw
8d52be9b96 "fix: update party order details route variable naming and test case ID" 2025-06-16 00:35:17 +08:00
louiscklaw
db16b2d5dd party-order delete ok, 2025-06-16 00:07:22 +08:00
louiscklaw
7370316ea0 party-order list ok, 2025-06-16 00:01:36 +08:00
louiscklaw
77f7211317 feat: add REQ0189 frontend party-order list and details pages with mock data and API integration 2025-06-15 23:08:14 +08:00
louiscklaw
dfc9873815 feat: add REQ0187 frontend party-order CRUD functionality and backend API endpoints 2025-06-15 22:27:44 +08:00
louiscklaw
53b112e488 "docs: update FAQ with questions about modifying .tsx.draft files and replacement starting point" 2025-06-15 22:27:06 +08:00
louiscklaw
a9dd265658 update REQ0185 content, 2025-06-15 21:07:07 +08:00
louiscklaw
ae39b7ca67 refactor: rename product to partyEvent in frontend components and views 2025-06-15 18:06:17 +08:00
louiscklaw
4c2a06585d refactor: rename product to partyEvent in list page and view component 2025-06-15 17:53:47 +08:00
louiscklaw
816d88c2c1 refactor: rename eventId to partyEventId in delete API route and test case 2025-06-15 17:08:36 +08:00
louiscklaw
843e459527 "chore: add db:push and seed commands to dev script startup sequence" 2025-06-15 17:08:17 +08:00
louiscklaw
cd0ae5ba62 "chore: increase seed event items count from 2 to 5" 2025-06-15 17:07:56 +08:00
louiscklaw
ecdbc45c4a refactor: rename product to partyEvent in API route, types and frontend components 2025-06-15 16:44:27 +08:00
louiscklaw
4b64778b59 refactor: rename product to party-event across frontend modules and types 2025-06-15 16:33:50 +08:00
louiscklaw
a88de2f17f "add PartyEvent frontend module with mock data, API actions, UI components and routing configuration" 2025-06-15 16:13:09 +08:00
louiscklaw
d987b0fe36 "update AI workspace instructions and move setup steps to init_AI.md" 2025-06-15 16:13:02 +08:00
louiscklaw
0142c9ba24 update frontend requirement REQ0185 from product update to party-event and create new REQ0186 with product update content 2025-06-15 16:12:33 +08:00
louiscklaw
48e1f821ad "adjust nodemon delay timing for TypeScript watch scripts across all projects" 2025-06-15 16:12:02 +08:00
louiscklaw
9943283eff "add PartyEvent API endpoints with service layer and test cases" 2025-06-15 15:01:18 +08:00
louiscklaw
9ac13787aa "update FAQ with prisma schema file path clarification" 2025-06-15 13:55:13 +08:00
louiscklaw
c1b71fca64 add helloworld API endpoint for product module with test case 2025-06-15 13:54:35 +08:00
louiscklaw
08642a2bf6 "update EventItem model schema with reordered and reorganized fields" 2025-06-15 13:54:24 +08:00
louiscklaw
043d45862c update markdown files and instructions in AI workspace 2025-06-15 13:16:53 +08:00
louiscklaw
8444b947a4 "update product list rendering" 2025-06-15 13:07:47 +08:00
louiscklaw
e791b01160 update, 2025-06-15 12:56:29 +08:00
louiscklaw
8383be13bc update, 2025-06-15 12:44:58 +08:00
louiscklaw
d82afe5a5f update prisma search products, 2025-06-15 12:42:08 +08:00
louiscklaw
1216bef8f8 "update tsconfig patterns and compiler options across all projects" 2025-06-15 12:08:17 +08:00
louiscklaw
02058981bf update gitignore patterns, fix build scripts, update product API test files 2025-06-15 11:49:03 +08:00
louiscklaw
b7cd25b614 build ok, 2025-06-15 11:28:24 +08:00
louiscklaw
c319c103f6 "add .env.example with API endpoint configurations" 2025-06-15 04:28:03 +08:00
louiscklaw
3213ef951b update, 2025-06-15 04:24:57 +08:00
louiscklaw
cc35015a3e update, 2025-06-15 04:23:50 +08:00
louiscklaw
253c2f2487 update, 2025-06-15 04:23:06 +08:00
louiscklaw
c74a273928 update, 2025-06-15 04:22:18 +08:00
louiscklaw
bebf9834e6 update, 2025-06-15 04:09:29 +08:00
louiscklaw
45bac1b3c8 update, 2025-06-15 03:50:15 +08:00
louiscklaw
862c5bd29c "add isDev environment flag to constants" 2025-06-15 02:52:37 +08:00
louiscklaw
1e1a2d63ae "update dev script to install dev dependencies and clear screen before running dev" 2025-06-15 02:51:57 +08:00
louiscklaw
3d2a8bb4f8 "update dev script to run db:push, seed and db:studio in development workflow" 2025-06-15 02:47:41 +08:00
louiscklaw
f53cf9d932 "implement product CRUD API endpoints and frontend integration" 2025-06-15 02:47:25 +08:00
louiscklaw
48e90bca1b update docker compose dev ports to expose mobile service on port 8081 2025-06-15 02:26:28 +08:00
louiscklaw
c3c93fbde9 "update dev script to clear screen and run lint check" 2025-06-15 02:26:19 +08:00
louiscklaw
17080edb40 update REQ0185, 2025-06-14 22:26:00 +08:00
louiscklaw
17249dee44 update REQ0185, 2025-06-14 22:25:08 +08:00
louiscklaw
bd7e6dd9e0 update REQ0183 2025-06-14 13:24:59 +08:00
louiscklaw
87ccb2f1ff update REQ0182, REQ0183, 2025-06-14 12:41:17 +08:00
louiscklaw
46f784d587 update add REQ0181 & REQ0182, 2025-06-14 12:31:00 +08:00
louiscklaw
66b9bf5bdd "Update docker compose files to expose service ports as per REQ0180" 2025-06-13 18:56:56 +08:00
louiscklaw
35b1cd1eba update, 2025-06-13 18:35:58 +08:00
louiscklaw
4de7a564e3 fix production environment no zsh, 2025-06-13 18:26:01 +08:00
louiscklaw
08d6727dca update prod script, 2025-06-13 18:11:57 +08:00
louiscklaw
d767108fcf fix broken build, 2025-06-13 18:11:12 +08:00
louiscklaw
5ff3393f54 add missing lib for mobile, 2025-06-13 13:33:20 +08:00
louiscklaw
5a531e1288 update add lib, 2025-06-13 13:19:15 +08:00
louiscklaw
5b7cf25753 delete test directory for production, 2025-06-13 13:08:08 +08:00
louiscklaw
19b2357771 "Update .gitignore to exclude _del and _test directories" 2025-06-13 13:06:01 +08:00
louiscklaw
9f7624fa56 "Add initial .gitconfig with user info, HTTP settings, branch defaults, and core preferences" 2025-06-13 12:23:29 +08:00
louiscklaw
346992d4ec Update requirement files with new feature templates and fix backend API error message, along with mobile project config updates and documentation improvements 2025-06-13 12:11:47 +08:00
louiscklaw
f23a6b7d9c "update service port documentation with subdomain information and add new feature requirements" 2025-06-13 12:10:44 +08:00
louiscklaw
ebc8a81641 "add docker compose up/down scripts and update vite config for production environment" 2025-06-11 18:49:28 +08:00
louiscklaw
f487427b2c "update service port configuration and docker setup" 2025-06-11 12:37:22 +08:00
louiscklaw
cc4d035f97 update documentation, 2025-06-08 22:26:41 +08:00
louiscklaw
84b223ff60 update, 2025-06-08 19:08:45 +08:00
louiscklaw
fca048074e update public folder, 2025-06-08 19:08:41 +08:00
louiscklaw
bc35e25616 update demo-sliding-profile, 2025-06-08 19:08:01 +08:00
louiscklaw
15f8d2e6aa update demo-shop-app-ui, 2025-06-08 19:08:01 +08:00
louiscklaw
592a099f7b update demo-score-board, 2025-06-08 19:08:01 +08:00
louiscklaw
4c1b30e5c6 update demo-restaurant-finder, 2025-06-08 19:08:00 +08:00
louiscklaw
c765bb49a4 update demo-recipe-app, 2025-06-08 19:08:00 +08:00
louiscklaw
9aeb58379d update demo-react-travel-app, 2025-06-08 19:08:00 +08:00
louiscklaw
6419567005 update demo-react-tabs-menus-custom, 2025-06-08 19:07:48 +08:00
louiscklaw
e2076fe67b update demo-react-switch-tabs, 2025-06-08 19:07:48 +08:00
louiscklaw
766720e075 update demo-react-shop-ui, 2025-06-08 19:07:48 +08:00
louiscklaw
19af60c410 update demo-react-shop, 2025-06-08 19:07:48 +08:00
louiscklaw
ed95621b2f update demo-react-quotes, 2025-06-08 19:07:48 +08:00
louiscklaw
2258fd8fb9 update demo-react-overlay-hooks, 2025-06-08 19:07:48 +08:00
louiscklaw
0f674badd9 update demo-react-onboarding-ui, 2025-06-08 19:07:48 +08:00
louiscklaw
bc731ea2b8 update demo-react-notes, 2025-06-08 19:07:48 +08:00
louiscklaw
c11dba6297 update demo-react-movie-app-with-algolia, 2025-06-08 19:07:38 +08:00
louiscklaw
b9fbe4e476 update demo-react-marvel-app, 2025-06-08 19:07:38 +08:00
louiscklaw
0d844eed3f update demo-react-login, 2025-06-08 19:07:38 +08:00
louiscklaw
2862cddb6b update demo-react-lifecycles, 2025-06-08 19:07:38 +08:00
louiscklaw
55509b483c update demo-react-item-list, 2025-06-08 19:07:38 +08:00
louiscklaw
3f2ac2a285 update demo-react-hook-form-example, 2025-06-08 19:07:38 +08:00
louiscklaw
1216de4ff9 update demo-react-drawing-canvas, 2025-06-08 19:07:29 +08:00
louiscklaw
7966d8abf5 update demo-react-calculator, 2025-06-08 19:07:29 +08:00
louiscklaw
e975aebfcd update demo-react-add-to-cart, 2025-06-08 19:07:29 +08:00
louiscklaw
7f6970b183 update demo-quote-app, 2025-06-08 19:07:29 +08:00
louiscklaw
e83854ed2a update demo-quiz-app, 2025-06-08 19:07:29 +08:00
louiscklaw
6961f058df update demo-list, 2025-06-08 19:06:46 +08:00
louiscklaw
b515337acc update demo-fast-food-app, 2025-06-08 19:06:25 +08:00
louiscklaw
c732d89c34 update demo-ecommerce-example, 2025-06-08 19:06:25 +08:00
louiscklaw
2b71d06c8d update demo-dictionary-app, 2025-06-08 19:06:25 +08:00
louiscklaw
3ec9d87f8b update demo-club-house, 2025-06-08 19:06:25 +08:00
louiscklaw
546fb72732 update demo-banking-ui, 2025-06-08 19:06:05 +08:00
louiscklaw
4303704753 update DemoSkeletonText, 2025-06-08 18:54:06 +08:00
louiscklaw
4bb213ef0c update DemoStickyBottomSheetExample, 2025-06-08 18:47:32 +08:00
louiscklaw
657c652657 updtae Demo2FaExample, 2025-06-08 18:40:35 +08:00
louiscklaw
5be77aae23 update DemoWeatherAppUi, 2025-06-08 16:44:59 +08:00
louiscklaw
ffbe63e421 update DemoStorageExample, 2025-06-08 16:16:40 +08:00
louiscklaw
ba1e718039 update DemoStickyBottomSheetExample, 2025-06-08 15:21:40 +08:00
louiscklaw
8b32d153db update DemoSkeletonText, 2025-06-08 15:04:56 +08:00
louiscklaw
d3e554b218 update DemoSkeletonText, 2025-06-08 11:06:30 +08:00
louiscklaw
5b10977a64 update DemoSkeletonText, 2025-06-08 11:05:39 +08:00
louiscklaw
a40b0fa4b1 update, 2025-06-08 09:20:18 +08:00
louiscklaw
a4692a7d1f update DemoReactThemeSwitcher, 2025-06-08 09:14:26 +08:00
louiscklaw
c3f680aa22 update demo-react-qr-code, 2025-06-07 10:36:15 +08:00
louiscklaw
5b680f2219 update demo-react-whatsapp-clone, 2025-06-07 10:18:28 +08:00
louiscklaw
d3d95469ea update demo-react-profile-dashboard-ui, 2025-06-07 09:41:52 +08:00
louiscklaw
04eaf91d60 update DemoReactMarvelApp, 2025-06-06 23:18:53 +08:00
louiscklaw
be571ba4db update demo-react-lifecycles, 2025-06-06 22:38:16 +08:00
louiscklaw
a6d549b2e8 update react-item-list example, 2025-06-06 22:32:08 +08:00
louiscklaw
beb1e0ae68 update react hook form example, 2025-06-06 22:27:14 +08:00
louiscklaw
b2adcff61b update canvas, 2025-06-06 22:21:22 +08:00
louiscklaw
8200e0d902 update calculator, 2025-06-06 15:00:30 +08:00
louiscklaw
731cb7500e update demo react add to cart, 2025-06-06 14:34:13 +08:00
louiscklaw
d6c87e33f0 update demo pull state, 2025-06-06 14:22:22 +08:00
louiscklaw
e4b6c5e92d update profile example, 2025-06-06 14:11:26 +08:00
louiscklaw
03782cde24 update ordering app, 2025-06-06 14:07:30 +08:00
louiscklaw
7cc6d939f5 update ordering app, 2025-06-06 14:01:03 +08:00
louiscklaw
3bcb40c5ef update kanban, 2025-06-06 13:44:21 +08:00
louiscklaw
43a285dd2c update intsagram demo, 2025-06-06 13:29:35 +08:00
louiscklaw
09a8dc539e update floating action button, 2025-06-06 13:16:31 +08:00
louiscklaw
8f75226763 update floating tab bar, 2025-06-06 13:09:59 +08:00
louiscklaw
7cfbcc1573 update fastfood, 2025-06-06 12:55:43 +08:00
louiscklaw
5234ac06cd update, 2025-06-06 12:41:25 +08:00
louiscklaw
aec59fb328 update, 2025-06-06 12:03:26 +08:00
louiscklaw
7f9b4c2224 Merge branch 'develop/mobile/update-add-demo-pages/demo-capacitor-google-maps-tutorial/trunk' into develop/mobile/update-add-demo-pages/demo-color-tutorial/troubhleshoop 2025-06-06 11:55:04 +08:00
louiscklaw
197b006df3 update, 2025-06-06 11:52:20 +08:00
louiscklaw
3692b2204b update, 2025-06-06 11:51:58 +08:00
louiscklaw
3217a8d594 update, 2025-06-06 11:50:25 +08:00
louiscklaw
d453144500 update App.tsx, 2025-06-06 11:47:14 +08:00
louiscklaw
e8d12f34e8 update, 2025-06-06 11:45:58 +08:00
louiscklaw
56d43062c9 update, 2025-06-05 14:05:24 +08:00
louiscklaw
c2a02cff77 Merge branch 'develop/mobile/update-add-demo-pages/demo-accordion-tutorial/trunk' into develop/mobile/update-add-demo-pages/demo-banking-ui/trunk 2025-06-05 13:53:46 +08:00
louiscklaw
d3ef280b20 update, 2025-06-05 13:51:25 +08:00
louiscklaw
b2e9616178 update, 2025-06-05 13:15:03 +08:00
3598 changed files with 55794 additions and 234810 deletions

19
.gitconfig Normal file
View File

@@ -0,0 +1,19 @@
[user]
email = louiscklaw@users.noreply.github.com
name = louiscklaw
[http]
version = HTTP/1.1
postBuffer = 5368709120
[init]
defaultBranch = master
[core]
autocrlf = false
[pull]
ff = only
rebase = true
[lfs]
allowincompletepush = true
locksverify = true
[credential]
autoDetectTimeout = -1
helper = cache --timeout=2592000

3
.gitignore vendored
View File

@@ -1,3 +1,6 @@
_del
_test
04_poc
**/*del
**/*bak

View File

@@ -77,12 +77,12 @@ const Chat = () => {
const [toastMessage, setToastMessage] = useState("");
// Refs
const contentRef = useRef();
const contentRef = useRef(null);
const swiperRefs = useRef([]);
const textareaRef = useRef();
const sideRef = useRef();
const sendRef = useRef();
const replyToAnimationRef = useRef();
const textareaRef = useRef(null);
const sideRef = useRef(null);
const sendRef = useRef(null);
const replyToAnimationRef = useRef(null);
const actionSheetButtons = [
{
@@ -104,7 +104,7 @@ const Chat = () => {
icon: alertOutline,
handler: () =>
toaster(
"I haven't implemented unsend :) Simple store update though",
"I haven't implemented unsend :) Simple store update though"
),
},
{
@@ -165,11 +165,11 @@ const Chat = () => {
const chatMessageID = elementID.includes("chatText")
? parseInt(elementID.replace("chatText_", ""))
: elementID.includes("chatTime")
? parseInt(elementID.replace("chatTime_", ""))
: parseInt(elementID.replace("chatBubble_", ""));
? parseInt(elementID.replace("chatTime_", ""))
: parseInt(elementID.replace("chatBubble_", ""));
const chatMessage = chat.filter(
(message) => parseInt(message.id) === parseInt(chatMessageID),
(message) => parseInt(message.id) === parseInt(chatMessageID)
)[0];
setActionMessage(chatMessage);
@@ -278,7 +278,7 @@ const Chat = () => {
replyToMessage,
replyToMessage ? replyToMessage.id : false,
image,
imagePath,
imagePath
);
setMessage("");
@@ -329,7 +329,7 @@ const Chat = () => {
fill="clear"
onClick={() =>
toaster(
"As this is a UI only, video calling wouldn't work here.",
"As this is a UI only, video calling wouldn't work here."
)
}
>
@@ -352,7 +352,7 @@ const Chat = () => {
{chat.map((message, index) => {
const repliedMessage = chat.filter(
(subMessage) =>
parseInt(subMessage.id) === parseInt(message.replyID),
parseInt(subMessage.id) === parseInt(message.replyID)
)[0];
return (
@@ -360,7 +360,9 @@ const Chat = () => {
ref={(ref) => (swiperRefs.current[index] = ref)}
id={`chatBubble_${message.id}`}
key={index}
className={`chat-bubble ${message.sent ? "bubble-sent" : "bubble-received"}`}
className={`chat-bubble ${
message.sent ? "bubble-sent" : "bubble-received"
}`}
{...longPressEvent}
>
<div id={`chatText_${message.id}`}>

View File

@@ -22,7 +22,7 @@ import { useRef } from "react";
import ContactModal from "../components/ContactModal";
const Chats = () => {
const pageRef = useRef();
const pageRef = useRef(null);
const contacts = ContactStore.useState(getContacts);
const latestChats = ChatStore.useState(getChats);
@@ -43,7 +43,7 @@ const Chats = () => {
contacts
.filter((c) => c.id === chat.contact_id)[0]
.name.toLowerCase()
.includes(searchTermLower),
.includes(searchTermLower)
);
setResults(newResults);
} else {

View File

@@ -0,0 +1,21 @@
---
tags: mobile
---
# REQ0119-Demo2FaExample
## description
A demonstration of two-factor authentication implementation examples
## schema
```dbml
{
// To be defined
}
```
## related
-

View File

@@ -0,0 +1,21 @@
---
tags:
---
# REQ0120-PlaceholderFeature
## description
T.B.A.
## schema
```dbml
{
// To be defined
}
```
## related
-

View File

@@ -0,0 +1,21 @@
---
tags:
---
# REQ0121-UserProfileFeature
## description
T.B.A.
## schema
```dbml
{
// To be defined
}
```
## related
-

View File

@@ -0,0 +1,21 @@
---
tags:
---
# REQ0122-NotificationSystem
## description
T.B.A.
## schema
```dbml
{
// To be defined
}
```
## related
-

View File

@@ -0,0 +1,21 @@
---
tags:
---
# REQ0123-AnalyticsDashboard
## description
T.B.A.
## schema
```dbml
{
// To be defined
}
```
## related
-

View File

@@ -0,0 +1,22 @@
---
tags: [placeholder-tag1, placeholder-tag2]
---
# REQ0124-PlaceholderTitle
## description
![alt text](placeholder-image.png)
## schema
```dbml
{
placeholderField1: Type;
placeholderField2: Type;
}
```
## related
[[REQXXXX]]

View File

@@ -0,0 +1,22 @@
---
tags: [placeholder-tag1, placeholder-tag2]
---
# REQ0125-PlaceholderTitle
## description
![alt text](placeholder-image.png)
## schema
```dbml
{
placeholderField1: Type;
placeholderField2: Type;
}
```
## related
[[REQXXXX]]

View File

@@ -0,0 +1,22 @@
---
tags: [placeholder-tag1, placeholder-tag2]
---
# REQ0126-PlaceholderTitle
## description
![alt text](placeholder-image.png)
## schema
```dbml
{
placeholderField1: Type;
placeholderField2: Type;
}
```
## related
[[REQXXXX]]

View File

@@ -0,0 +1,22 @@
---
tags: [placeholder-tag1, placeholder-tag2]
---
# REQ0127-PlaceholderTitle
## description
![alt text](placeholder-image.png)
## schema
```dbml
{
placeholderField1: Type;
placeholderField2: Type;
}
```
## related
[[REQXXXX]]

View File

@@ -0,0 +1,22 @@
---
tags: [placeholder-tag1, placeholder-tag2]
---
# REQ0128-PlaceholderTitle
## description
![alt text](placeholder-image.png)
## schema
```dbml
{
placeholderField1: Type;
placeholderField2: Type;
}
```
## related
[[REQXXXX]]

View File

@@ -0,0 +1,22 @@
---
tags: [placeholder-tag1, placeholder-tag2]
---
# REQ0129-PlaceholderTitle
## description
![alt text](placeholder-image.png)
## schema
```dbml
{
placeholderField1: Type;
placeholderField2: Type;
}
```
## related
[[REQXXXX]]

View File

@@ -0,0 +1,22 @@
---
tags: [placeholder-tag1, placeholder-tag2]
---
# REQ0130-PlaceholderTitle
## description
![alt text](placeholder-image.png)
## schema
```dbml
{
placeholderField1: Type;
placeholderField2: Type;
}
```
## related
[[REQXXXX]]

View File

@@ -0,0 +1,22 @@
---
tags: requirements
---
# REQ0131-DemoInstagramClone
## description
<Party Page.png>
## schema
```dbml
// Add your DBML here
Table users {
id integer
}
```
## related
[[REQ0110-PartyPage]]

View File

@@ -0,0 +1,23 @@
---
tags: requirements
---
# REQ0132-DemoKanbanBoard
## description
<Kanban Board.png>
## schema
```dbml
// Add your DBML here
Table tasks {
id integer
status string
}
```
## related
[[REQ0131-DemoInstagramClone]]

View File

@@ -0,0 +1,23 @@
---
tags: requirements
---
# REQ0133-DemoList
## description
<Demo List.png>
## schema
```dbml
// Add your DBML here
Table lists {
id integer
name string
}
```
## related
[[REQ0132-DemoKanbanBoard]]

View File

@@ -0,0 +1,23 @@
---
tags: requirements
---
# REQ0134-DemoOrderingApp
## description
<Ordering App.png>
## schema
```dbml
// Add your DBML here
Table orders {
id integer
item string
}
```
## related
[]

View File

@@ -0,0 +1,24 @@
---
tags: requirements
---
# REQ0135-DemoPinterestFloatingTabBar
## description
<Pinterest Floating Tab Bar.png>
## schema
```dbml
// Add your DBML here
Table floating_tab_bars {
id integer
position string
items json
}
```
## related
[[REQ0134-DemoList]]

View File

@@ -0,0 +1,24 @@
---
tags: requirements
---
# REQ0136-DemoProfileExample
## description
<Profile Example.png>
## schema
```dbml
// Add your DBML here
Table profiles {
id integer
name string
avatar_url string
}
```
## related
[[REQ0135-DemoPinterestFloatingTabBar]]

View File

@@ -0,0 +1,24 @@
---
tags: [requirements]
---
# REQ0137-DemoPullstateTutorial
## Description
![Pullstate Tutorial](Pullstate%20Tutorial.png)
## Schema
```dbml
// Add your DBML here
Table pullstates {
id integer
state json
timestamp datetime
}
```
## Related
- [REQ0136-DemoProfileExample](#)

View File

@@ -0,0 +1,24 @@
---
tags: [requirements]
---
# REQ0138-DemoQrScanner
## Description
![QR Scanner](QR%20Scanner.png)
## Schema
```dbml
// Add your DBML here
Table qr_scanners {
id integer
scan_data string
scan_time datetime
}
```
## Related
- [REQ0137-DemoPullstateTutorial](#)

View File

@@ -0,0 +1,24 @@
---
tags: [requirements]
---
# REQ0139-DemoQuizApp
## Description
![Quiz App](Quiz%20App.png)
## Schema
```dbml
// Add your DBML here
Table quizzes {
id integer
questions json
results json
}
```
## Related
- [REQ0138-DemoQrScanner](#)

View File

@@ -0,0 +1,25 @@
---
tags: [requirements]
---
# REQ0140-DemoQuoteApp
## Description
![Quote App](Quote%20App.png)
## Schema
```dbml
// Add your DBML here
Table quotes {
id integer
content string
author string
category string
}
```
## Related
- [REQ0139-DemoQuizApp](#)

View File

@@ -0,0 +1,25 @@
---
tags: [requirements]
---
# REQ0141-DemoReactAddToCart
## Description
![React Add To Cart](React%20Add%20To%20Cart.png)
## Schema
```dbml
// Add your DBML here
Table cart_items {
id integer
product_id integer
quantity integer
user_id integer
}
```
## Related
- [REQ0140-DemoQuoteApp](#)

View File

@@ -0,0 +1,25 @@
---
tags: [requirements]
---
# REQ0142-DemoReactCalculator
## Description
![React Calculator](React%20Calculator.png)
## Schema
```dbml
// Add your DBML here
Table calculations {
id integer
expression string
result float
timestamp datetime
}
```
## Related
- [REQ0141-DemoReactAddToCart](#)

View File

@@ -0,0 +1,25 @@
---
tags: [requirements]
---
# REQ0143-DemoReactDrawingCanvas
## Description
![React Drawing Canvas](React%20Drawing%20Canvas.png)
## Schema
```dbml
// Add your DBML here
Table drawings {
id integer
canvas_data json
created_at datetime
updated_at datetime
}
```
## Related
- [REQ0142-DemoReactCalculator](#)

View File

@@ -0,0 +1,25 @@
---
tags: [requirements]
---
# REQ0144-DemoReactHookFormExample
## Description
![React Hook Form Example](React%20Hook%20Form%20Example.png)
## Schema
```dbml
// Add your DBML here
Table forms {
id integer
form_data json
submitted_at datetime
user_id integer
}
```
## Related
- [REQ0143-DemoReactDrawingCanvas](#)

View File

@@ -0,0 +1,26 @@
---
tags: [requirements]
---
# REQ0145-DemoReactItemList
## Description
![React Item List](React%20Item%20List.png)
## Schema
```dbml
// Add your DBML here
Table items {
id integer
name string
description text
price decimal
created_at datetime
}
```
## Related
- [REQ0144-DemoReactHookFormExample](#)

View File

@@ -0,0 +1,26 @@
---
tags: [requirements]
---
# REQ0146-DemoReactLifecycles
## Description
![React Lifecycles](React%20Lifecycles.png)
## Schema
```dbml
// Add your DBML here
Table components {
id integer
name string
lifecycle_stage string
mounted_at datetime
updated_at datetime
}
```
## Related
- [REQ0145-DemoReactItemList](#)

View File

@@ -0,0 +1,26 @@
---
tags: [requirements]
---
# REQ0147-DemoReactLogin
## Description
![React Login](React%20Login.png)
## Schema
```dbml
// Add your DBML here
Table users {
id integer
username string
password_hash string
last_login_at datetime
login_count integer
}
```
## Related
- [REQ0146-DemoReactLifecycles](#)

View File

@@ -0,0 +1,26 @@
---
tags: [requirements]
---
# REQ0148-DemoReactMarvelApp
## Description
![React Marvel App](React%20Marvel%20App.png)
## Schema
```dbml
// Add your DBML here
Table characters {
id integer
name string
description text
thumbnail_url string
comics_available integer
}
```
## Related
- [REQ0147-DemoReactLogin](#)

View File

@@ -0,0 +1,27 @@
---
tags: [requirements]
---
# REQ0149-DemoReactMovieAppWithAlgolia
## Description
![React Movie App with Algolia](React%20Movie%20App%20with%20Algolia.png)
## Schema
```dbml
// Add your DBML here
Table movies {
id integer
title string
year integer
rating decimal
search_index string
last_updated datetime
}
```
## Related
- [REQ0148-DemoReactMarvelApp](#)

View File

@@ -0,0 +1,27 @@
---
tags: [requirements]
---
# REQ0150-DemoReactNotes
## Description
![React Notes App](React%20Notes%20App.png)
## Schema
```dbml
// Add your DBML here
Table notes {
id integer
title string
content text
created_at datetime
updated_at datetime
is_pinned boolean
}
```
## Related
- [REQ0149-DemoReactMovieAppWithAlgolia](#)

View File

@@ -0,0 +1,27 @@
---
tags: [requirements]
---
# REQ0151-DemoReactOnboardingUi
## Description
![React Onboarding UI](React%20Onboarding%20UI.png)
## Schema
```dbml
// Add your DBML here
Table onboarding_steps {
id integer
title string
description text
is_completed boolean
order_number integer
component_name string
}
```
## Related
- [REQ0150-DemoReactNotes](#)

View File

@@ -0,0 +1,26 @@
---
tags: [requirements]
---
# REQ0152-DemoReactOverlayHooks
## Description
![React Overlay Hooks](React%20Overlay%20Hooks.png)
## Schema
```dbml
// Add your DBML here
Table overlays {
id integer
component_name string
is_visible boolean
z_index integer
animation_type string
}
```
## Related
- [REQ0151-DemoReactOnboardingUi](#)

View File

@@ -0,0 +1,10 @@
---
tags: [requirements]
---
# REQ0153-DemoReactPollApp
## Description
![React Poll App](React%20Poll%20App.png)
## Schema

View File

@@ -0,0 +1 @@
# DemoReactProfileDashboardUi

View File

@@ -0,0 +1 @@
# DemoReactQuotes

View File

@@ -0,0 +1 @@
# DemoReactShop

View File

@@ -0,0 +1 @@
# DemoReactShopUi

View File

@@ -0,0 +1 @@
# DemoReactSwitchTabs

View File

@@ -0,0 +1 @@
# DemoReactTabsMenusCustom

View File

@@ -0,0 +1 @@
# DemoReactThemeSwitcher

View File

@@ -0,0 +1 @@
# DemoReactTravelApp

View File

@@ -0,0 +1 @@
# DemoRecipeApp

View File

@@ -0,0 +1 @@
# DemoRestaurantFinder

View File

@@ -0,0 +1 @@
# DemoScoreBoard

View File

@@ -0,0 +1 @@
# DemoShopAppUi

View File

@@ -0,0 +1 @@
# DemoSkeletonText

View File

@@ -0,0 +1 @@
# DemoSlidingProfile

View File

@@ -0,0 +1 @@
# DemoStickyBottomSheetExample

View File

@@ -0,0 +1 @@
# DemoStorageExample

View File

@@ -0,0 +1 @@
# DemoWeatherAppUi

View File

@@ -0,0 +1,16 @@
---
tags: docker, ports
---
# REQ0180 service port schedule
## Port Usage
| Service | Host **Port** | Container Port | Environment | Purpose | subdomain |
| ----------- | ------------- | -------------- | ----------- | -------------------------------- | ------------------------ |
| Frontend | 10001 | 8080 | All | Web application access | pa_admin.louislabs.com |
| Mobile | 10004 | 3000 | All | Mobile application access | pa_mobile.louislabs.com |
| CMS Backend | 10002 | 7272 | All | Main API access | pa_backend.louislabs.com |
| CMS Backend | 10003 | 5555 | All | Additional service access | --- |
| Postgres | - | 5432 | Production | Database access (container only) | --- |
| Postgres | 5432 | 5432 | Development | Database access | --- |

View File

@@ -0,0 +1,9 @@
---
tags: frontend, side-menu
---
# REQ0181 frontend side menu configuration
## sources
`src/layouts/nav-config-dashboard.tsx`

View File

@@ -0,0 +1,11 @@
---
tags: frontend, product, details
---
# REQ0182 frontend product details
frontend page to display product details
## sources
T.B.A.

View File

@@ -0,0 +1,15 @@
---
tags: frontend, product, new
---
# REQ0183 frontend product new
frontend page to create new product
## sources
T.B.A.
## branch
develop/requirements/REQ0183

View File

@@ -0,0 +1,17 @@
---
tags: frontend, product, delete
---
# REQ0184 frontend product delete
frontend page to delete product
list page
## sources
T.B.A.
## branch
develop/requirements/REQ0184

View File

@@ -0,0 +1,18 @@
---
tags: frontend, party-event
---
# REQ0185 frontend party-event
frontend page to handle party-event (CRUD)
edit page T.B.A.
## sources
T.B.A.
## branch
develop/frontend/party-event/trunk
develop/requirements/REQ0185

View File

@@ -0,0 +1,17 @@
---
tags: frontend, product, update
---
# REQ0185 frontend product update
frontend page to update product
edit page T.B.A.
## sources
T.B.A.
## branch
develop/requirements/REQ0185

View File

@@ -0,0 +1,23 @@
---
tags: frontend, party-order
---
# REQ0185 frontend party-order
frontend page to handle party-order (CRUD)
edit page T.B.A.
## TODO
- remove detail in left nav bar
- implement `changeStatus`
## sources
T.B.A.
## branch
develop/frontend/party-order/trunk
develop/requirements/REQ0187

View File

@@ -0,0 +1,21 @@
---
tags: frontend, party-user
---
# REQ0188 frontend party-user
frontend page to handle party-user (CRUD)
edit page T.B.A.
## TODO
## sources
T.B.A.
## branch
develop/requirements/REQ0188
develop/frontend/party-user/trunk
develop/frontend/party-user-auth/trunk

View File

@@ -0,0 +1,20 @@
---
tags: mobile, payment
---
# REQ0189 party payment flow
frontend page to handle party-user pay join event
edit page T.B.A.
## TODO
## sources
T.B.A.
## branch
develop/requirements/REQ0189
develop/mobile/DummyPayPage/trunk

View File

@@ -105,3 +105,61 @@
- [REQ0116: REQ0116/main-tab](./REQ0116/index.md)
- [REQ0117: REQ0117/default-route](./REQ0117/index.md)
- [REQ0118: REQ0118/Not-Implemented-page](./REQ0118/index.md)
- [REQ0119: REQ0119-Demo2FaExample](./REQ0119/index.md)
- [REQ0120: REQ0120-PlaceholderFeature](./REQ0120/index.md)
- [REQ0121: REQ0121-UserProfileFeature](./REQ0121/index.md)
- [REQ0122: REQ0122-NotificationSystem](./REQ0122/index.md)
- [REQ0123: REQ0123-AnalyticsDashboard](./REQ0123/index.md)
- [REQ0124: REQ0124-PlaceholderTitle](./REQ0124/index.md)
- [REQ0125: REQ0125-PlaceholderTitle](./REQ0125/index.md)
- [REQ0126: REQ0126-PlaceholderTitle](./REQ0126/index.md)
- [REQ0127: REQ0127-PlaceholderTitle](./REQ0127/index.md)
- [REQ0128: REQ0128-PlaceholderTitle](./REQ0128/index.md)
- [REQ0129: REQ0129-PlaceholderTitle](./REQ0129/index.md)
- [REQ0130: REQ0130-PlaceholderTitle](./REQ0130/index.md)
- [REQ0131: REQ0131-DemoInstagramClone](./REQ0131/index.md)
- [REQ0132: REQ0132-DemoKanbanBoard](./REQ0132/index.md)
- [REQ0133: REQ0133-DemoList](./REQ0133/index.md)
- [REQ0134: REQ0134-DemoOrderingApp](./REQ0134/index.md)
- [REQ0135: REQ0135-DemoPinterestFloatingTabBar](./REQ0135/index.md)
- [REQ0136: REQ0136-DemoProfileExample](./REQ0136/index.md)
- [REQ0137: REQ0137-DemoPullstateTutorial](./REQ0137/index.md)
- [REQ0138: REQ0138-DemoQrScanner](./REQ0138/index.md)
- [REQ0139: REQ0139-DemoQuizApp](./REQ0139/index.md)
- [REQ0140: REQ0140-DemoQuoteApp](./REQ0140/index.md)
- [REQ0141: REQ0141-DemoReactAddToCart](./REQ0141/index.md)
- [REQ0142: REQ0142-DemoReactCalculator](./REQ0142/index.md)
- [REQ0143: REQ0143-DemoReactDrawingCanvas](./REQ0143/index.md)
- [REQ0144: REQ0144-DemoReactHookFormExample](./REQ0144/index.md)
- [REQ0145: REQ0145-DemoReactItemList](./REQ0145/index.md)
- [REQ0146: REQ0146-DemoReactLifecycles](./REQ0146/index.md)
- [REQ0147: REQ0147-DemoReactLogin](./REQ0147/index.md)
- [REQ0148: REQ0148-DemoReactMarvelApp](./REQ0148/index.md)
- [REQ0149: REQ0149-DemoReactMovieAppWithAlgolia](./REQ0149/index.md)
- [REQ0150: REQ0150-DemoReactNotes](./REQ0150/index.md)
- [REQ0151: REQ0151-DemoReactOnboardingUi](./REQ0151/index.md)
- [REQ0152: REQ0152-DemoReactOverlayHooks](./REQ0152/index.md)
- [REQ0153: REQ0153-DemoReactPollApp](./REQ0153/index.md)
- [REQ0154: DemoReactProfileDashboardUi](./REQ0154/index.md)
- [REQ0155: DemoReactQuotes](./REQ0155/index.md)
- [REQ0156: DemoReactShop](./REQ0156/index.md)
- [REQ0157: DemoReactShopUi](./REQ0157/index.md)
- [REQ0158: DemoReactSwitchTabs](./REQ0158/index.md)
- [REQ0159: DemoReactTabsMenusCustom](./REQ0159/index.md)
- [REQ0160: DemoReactThemeSwitcher](./REQ0160/index.md)
- [REQ0161: DemoReactTravelApp](./REQ0161/index.md)
- [REQ0162: DemoRecipeApp](./REQ0162/index.md)
- [REQ0163: DemoRestaurantFinder](./REQ0163/index.md)
- [REQ0164: DemoScoreBoard](./REQ0164/index.md)
- [REQ0165: DemoShopAppUi](./REQ0165/index.md)
- [REQ0166: DemoSkeletonText](./REQ0166/index.md)
- [REQ0167: DemoSlidingProfile](./REQ0167/index.md)
- [REQ0168: DemoStickyBottomSheetExample](./REQ0168/index.md)
- [REQ0169: DemoStorageExample](./REQ0169/index.md)
- [REQ0170: DemoWeatherAppUi](./REQ0170/index.md)
- [REQ0180: REQ0180 service port schedule](./REQ0180/index.md)
- [REQ0181: REQ0181 frontend side menu configuration](./REQ0181/index.md)
- [REQ0182: REQ0182 frontend product details](./REQ0182/index.md)
- [REQ0183: REQ0183 frontend product new](./REQ0183/index.md)
- [REQ0184: REQ0184 frontend product delete](./REQ0184/index.md)
- [REQ0185: REQ0185 frontend product update](./REQ0185/index.md)

View File

@@ -1,4 +0,0 @@
node_modules
.git
.gitignore
.DS_Store

View File

@@ -1,9 +0,0 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View File

@@ -1,25 +0,0 @@
# Port number
PORT=3000
# Postgres URL
DATABASE_URL="postgresql://postgres:secret@localhost:5432/mydb?schema=public"
# JWT
# JWT secret key
JWT_SECRET=thisisasamplesecret
# Number of minutes after which an access token expires
JWT_ACCESS_EXPIRATION_MINUTES=30
# Number of days after which a refresh token expires
JWT_REFRESH_EXPIRATION_DAYS=30
# Number of minutes after which a reset password token expires
JWT_RESET_PASSWORD_EXPIRATION_MINUTES=10
# Number of minutes after which a verify email token expires
JWT_VERIFY_EMAIL_EXPIRATION_MINUTES=10
# SMTP configuration options for the email service
# For testing, you can use a fake SMTP service like Ethereal: https://ethereal.email/create
SMTP_HOST=email-server
SMTP_PORT=587
SMTP_USERNAME=email-server-username
SMTP_PASSWORD=email-server-password
EMAIL_FROM=support@yourapp.com

View File

@@ -1,2 +0,0 @@
node_modules
bin

View File

@@ -1,14 +0,0 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
}

View File

@@ -1,21 +0,0 @@
# Dependencies
node_modules
# yarn error logs
yarn-error.log
# Environment varibales
.env*
!.env*.example
# Code coverage
coverage
# misc
.DS_Store
# Dev db data
db
# TypeScript
build

View File

@@ -1,3 +0,0 @@
{
"*.ts": "eslint"
}

View File

@@ -1,7 +0,0 @@
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none"
}

View File

@@ -1,5 +0,0 @@
{
"recommendations": [
"prisma.prisma"
]
}

View File

@@ -1,3 +0,0 @@
{
"python.formatting.provider": "yapf"
}

View File

@@ -1,61 +0,0 @@
# Contributing to prisma-express-typescript-boilerplate
Thank you for your interest in contributing to the prisma-express-typescript-boilerplate project! Your contributions are valuable in making this project better for everyone. Before you start contributing, please take a moment to review the guidelines below.
## Getting Started
1. **Fork the Repository**: Start by forking the prisma-express-typescript-boilerplate repository to your own GitHub account. You can do this by clicking the "Fork" button on the repository page.
2. **Clone the Repository**: Clone your forked repository to your local machine using the following command:
```git clone https://github.com/your-username/prisma-express-typescript-boilerplate.git ```
3. **Install Dependencies**: Navigate to the cloned repository directory and install the project dependencies by running:
```npm install```
## Making Changes
1. **Create a Branch**: Create a new branch for your changes. Use a descriptive name that reflects the nature of your contribution. For example:
```git checkout -b my-contribution```
2. **Implement Your Changes**: Make the necessary modifications and improvements to the project. This could involve bug fixes, feature enhancements, documentation updates, or any other relevant changes.
3. **Test Your Changes**: Ensure that your modifications work as intended and don't introduce any regressions. Run the existing tests using:
```npm test```
If you're adding new features, consider writing tests to cover the new functionality.
4. **Commit Your Changes**: Once you're satisfied with your changes, commit them with a clear and descriptive commit message:
```git add .```
```git commit -m "Add my contribution```
5. **Push Your Changes**: Push your changes to your forked repository:
## Submitting a Pull Request
1. **Open a Pull Request**: Go to the main page of your forked repository on GitHub and switch to the branch you just pushed. Click on the "Compare & pull request" button next to the branch name.
2. **Provide a Description**: In the pull request description, clearly explain the purpose and details of your contribution. Reference any relevant issues or feature requests if applicable.
3. **Review Process**: The project maintainers will review your pull request, providing feedback or suggesting changes if necessary. Be open to discussion and iterate on your changes based on the feedback received.
4. **Merge Your Pull Request**: Once your pull request has been approved and passes the review process, it will be merged into the main repository. Congratulations on your successful contribution!
## Code of Conduct
Please note that the prisma-express-typescript-boilerplate project follows a Code of Conduct. Respectful and inclusive behavior is expected from all contributors. Familiarize yourself with the project's Code of Conduct to ensure a positive and welcoming environment for everyone.
## Getting Help
If you have any questions or need assistance during the contribution process, don't hesitate to reach out to the project maintainers by opening an issue on the repository. They will be happy to help you.
Thank you for your interest in contributing to the prisma-express-typescript-boilerplate project. Your contributions make a difference!

View File

@@ -1,15 +0,0 @@
FROM node:18-alpine3.16
RUN mkdir -p /usr/src/node-app && chown -R node:node /usr/src/node-app
WORKDIR /usr/src/node-app
COPY package.json yarn.lock ./
USER node
RUN yarn install --pure-lockfile
COPY --chown=node:node . .
EXPOSE 3000

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2022 Antonio Lázaro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,370 +0,0 @@
# RESTful API Node Server Boilerplate
A boilerplate/starter project for quickly building RESTful APIs using [Node.js](https://nodejs.org), [TypeScript](https://www.typescriptlang.org), [Express](https://expressjs.com), and [Prisma](https://www.prisma.io).
This project is an adaptation of the project [RESTful API Node Server Boilerplate](https://github.com/hagopj13/node-express-boilerplate) using a [PostgreSQL](https://www.postgresql.org) database with [Prisma](https://www.prisma.io) ORM. Many of the files are just an adaptation to [TypeScript](https://www.typescriptlang.org) from the files of the previously mentioned project.
## Quick Start
Clone the repo:
```bash
git clone --depth 1 https://github.com/antonio-lazaro/prisma-express-typescript-boilerplate.git
cd prisma-express-typescript-boilerplate
npx rimraf ./.git
```
Install the dependencies:
```bash
yarn install
```
Set the environment variables:
```bash
cp .env.example .env
# open .env and modify the environment variables (if needed)
```
## Table of Contents
- [RESTful API Node Server Boilerplate](#restful-api-node-server-boilerplate)
- [Quick Start](#quick-start)
- [Table of Contents](#table-of-contents)
- [Features](#features)
- [Commands](#commands)
- [Environment Variables](#environment-variables)
- [Project Structure](#project-structure)
- [API Documentation](#api-documentation)
- [API Endpoints](#api-endpoints)
- [Error Handling](#error-handling)
- [Validation](#validation)
- [Authentication](#authentication)
- [Authorization](#authorization)
- [Logging](#logging)
- [Linting](#linting)
- [Contributing](#contributing)
- [Inspirations](#inspirations)
- [License](#license)
## Features
- **SQL database**: [PostgreSQL](https://www.postgresql.org) object data modeling using [Prisma](https://www.prisma.io) ORM
- **Authentication and authorization**: using [passport](http://www.passportjs.org)
- **Validation**: request data validation using [Joi](https://joi.dev)
- **Logging**: using [winston](https://github.com/winstonjs/winston) and [morgan](https://github.com/expressjs/morgan)
- `future` **Testing**: unit and integration tests using [Jest](https://jestjs.io)
- **Error handling**: centralized error handling mechanism
- **API documentation**: with [swagger-jsdoc](https://github.com/Surnet/swagger-jsdoc) and [swagger-ui-express](https://github.com/scottie1984/swagger-ui-express)
- **Process management**: advanced production process management using [PM2](https://pm2.keymetrics.io)
- **Dependency management**: with [Yarn](https://yarnpkg.com)
- **Environment variables**: using [dotenv](https://github.com/motdotla/dotenv) and [cross-env](https://github.com/kentcdodds/cross-env#readme)
- **Security**: set security HTTP headers using [helmet](https://helmetjs.github.io)
- **Santizing**: sanitize request data against xss and query injection
- **CORS**: Cross-Origin Resource-Sharing enabled using [cors](https://github.com/expressjs/cors)
- **Compression**: gzip compression with [compression](https://github.com/expressjs/compression)
- **Docker support**
- **Code coverage**: using [coveralls](https://coveralls.io)
- **Code quality**: with [Codacy](https://www.codacy.com)
- **Git hooks**: with [Husky](https://github.com/typicode/husky) and [lint-staged](https://github.com/okonet/lint-staged)
- **Linting**: with [ESLint](https://eslint.org) and [Prettier](https://prettier.io)
- **Editor config**: consistent editor configuration using [EditorConfig](https://editorconfig.org)
## Commands
Running locally:
```bash
yarn dev
```
Running in production:
```bash
yarn start
```
Testing:
```bash
# run all tests
yarn test
# run all tests in watch mode
yarn test:watch
# run test coverage
yarn coverage
```
Database:
```bash
# push changes to db
yarn db:push
# start prisma studio
yarn db:studio
```
Docker:
```bash
# run docker container in development mode
yarn docker:dev
# run docker container in production mode
yarn docker:prod
# run all tests in a docker container
yarn docker:test
# run docker container with PostgreSQL db
yarn docker:dev-db:start
# stop docker container with PostgreSQL db
yarn docker:dev-db:stop
```
Linting:
```bash
# run ESLint
yarn lint
# fix ESLint errors
yarn lint:fix
# run prettier
yarn prettier
# fix prettier errors
yarn prettier:fix
```
## Environment Variables
The environment variables can be found and modified in the `.env` file. They come with these default values:
```bash
# Port number
PORT=3000
# URL of the PostgreSQL database
DATABASE_URL=postgresql://postgres:secret@localhost:5432/mydb?schema=public
# JWT
# JWT secret key
JWT_SECRET=thisisasamplesecret
# Number of minutes after which an access token expires
JWT_ACCESS_EXPIRATION_MINUTES=30
# Number of days after which a refresh token expires
JWT_REFRESH_EXPIRATION_DAYS=30
# SMTP configuration options for the email service
# For testing, you can use a fake SMTP service like Ethereal: https://ethereal.email/create
SMTP_HOST=email-server
SMTP_PORT=587
SMTP_USERNAME=email-server-username
SMTP_PASSWORD=email-server-password
EMAIL_FROM=support@yourapp.com
```
## Project Structure
```
src\
|--config\ # Environment variables and configuration related things
|--controllers\ # Route controllers (controller layer)
|--docs\ # Swagger files
|--middlewares\ # Custom express middlewares
|--routes\ # Routes
|--services\ # Business logic (service layer)
|--utils\ # Utility classes and functions
|--validations\ # Request data validation schemas
|--app.js # Express app
|--index.js # App entry point
```
## API Documentation
To view the list of available APIs and their specifications, run the server and go to `http://localhost:3000/v1/docs` in your browser. This documentation page is automatically generated using the [swagger](https://swagger.io/) definitions written as comments in the route files.
### API Endpoints
List of available routes:
**Auth routes**:\
`POST /v1/auth/register` - register\
`POST /v1/auth/login` - login\
`POST /v1/auth/refresh-tokens` - refresh auth tokens\
`POST /v1/auth/forgot-password` - send reset password email\
`POST /v1/auth/reset-password` - reset password\
`POST /v1/auth/send-verification-email` - send verification email\
`POST /v1/auth/verify-email` - verify email
**User routes**:\
`POST /v1/users` - create a user\
`GET /v1/users` - get all users\
`GET /v1/users/:userId` - get user\
`PATCH /v1/users/:userId` - update user\
`DELETE /v1/users/:userId` - delete user
## Error Handling
The app has a centralized error handling mechanism.
Controllers should try to catch the errors and forward them to the error handling middleware (by calling `next(error)`). For convenience, you can also wrap the controller inside the catchAsync utility wrapper, which forwards the error.
```javascript
const catchAsync = require('../utils/catchAsync');
const controller = catchAsync(async (req, res) => {
// this error will be forwarded to the error handling middleware
throw new Error('Something wrong happened');
});
```
The error handling middleware sends an error response, which has the following format:
```json
{
"code": 404,
"message": "Not found"
}
```
When running in development mode, the error response also contains the error stack.
The app has a utility ApiError class to which you can attach a response code and a message, and then throw it from anywhere (catchAsync will catch it).
For example, if you are trying to get a user from the DB who is not found, and you want to send a 404 error, the code should look something like:
```javascript
const httpStatus = require('http-status');
const ApiError = require('../utils/ApiError');
const User = require('../models/User');
const getUser = async (userId) => {
const user = await User.findById(userId);
if (!user) {
throw new ApiError(httpStatus.NOT_FOUND, 'User not found');
}
};
```
## Validation
Request data is validated using [Joi](https://joi.dev/). Check the [documentation](https://joi.dev/api/) for more details on how to write Joi validation schemas.
The validation schemas are defined in the `src/validations` directory and are used in the routes by providing them as parameters to the `validate` middleware.
```javascript
const express = require('express');
const validate = require('../../middlewares/validate');
const userValidation = require('../../validations/user.validation');
const userController = require('../../controllers/user.controller');
const router = express.Router();
router.post('/users', validate(userValidation.createUser), userController.createUser);
```
## Authentication
To require authentication for certain routes, you can use the `auth` middleware.
```javascript
const express = require('express');
const auth = require('../../middlewares/auth');
const userController = require('../../controllers/user.controller');
const router = express.Router();
router.post('/users', auth(), userController.createUser);
```
These routes require a valid JWT access token in the Authorization request header using the Bearer schema. If the request does not contain a valid access token, an Unauthorized (401) error is thrown.
**Generating Access Tokens**:
An access token can be generated by making a successful call to the register (`POST /v1/auth/register`) or login (`POST /v1/auth/login`) endpoints. The response of these endpoints also contains refresh tokens (explained below).
An access token is valid for 30 minutes. You can modify this expiration time by changing the `JWT_ACCESS_EXPIRATION_MINUTES` environment variable in the .env file.
**Refreshing Access Tokens**:
After the access token expires, a new access token can be generated, by making a call to the refresh token endpoint (`POST /v1/auth/refresh-tokens`) and sending along a valid refresh token in the request body. This call returns a new access token and a new refresh token.
A refresh token is valid for 30 days. You can modify this expiration time by changing the `JWT_REFRESH_EXPIRATION_DAYS` environment variable in the .env file.
## Authorization
The `auth` middleware can also be used to require certain rights/permissions to access a route.
```javascript
const express = require('express');
const auth = require('../../middlewares/auth');
const userController = require('../../controllers/user.controller');
const router = express.Router();
router.post('/users', auth('manageUsers'), userController.createUser);
```
In the example above, an authenticated user can access this route only if that user has the `manageUsers` permission.
The permissions are role-based. You can view the permissions/rights of each role in the `src/config/roles.js` file.
If the user making the request does not have the required permissions to access this route, a Forbidden (403) error is thrown.
## Logging
Import the logger from `src/config/logger.js`. It is using the [Winston](https://github.com/winstonjs/winston) logging library.
Logging should be done according to the following severity levels (ascending order from most important to least important):
```javascript
const logger = require('<path to src>/config/logger');
logger.error('message'); // level 0
logger.warn('message'); // level 1
logger.info('message'); // level 2
logger.http('message'); // level 3
logger.verbose('message'); // level 4
logger.debug('message'); // level 5
```
In development mode, log messages of all severity levels will be printed to the console.
In production mode, only `info`, `warn`, and `error` logs will be printed to the console.\
It is up to the server (or process manager) to actually read them from the console and store them in log files.\
This app uses pm2 in production mode, which is already configured to store the logs in log files.
Note: API request information (request url, response code, timestamp, etc.) are also automatically logged (using [morgan](https://github.com/expressjs/morgan)).
## Linting
Linting is done using [ESLint](https://eslint.org/) and [Prettier](https://prettier.io).
In this app, ESLint is configured to follow the [Airbnb JavaScript style guide](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base) with some modifications. It also extends [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) to turn off all rules that are unnecessary or might conflict with Prettier.
To modify the ESLint configuration, update the `.eslintrc.json` file. To modify the Prettier configuration, update the `.prettierrc.json` file.
To prevent a certain file or directory from being linted, add it to `.eslintignore` and `.prettierignore`.
To maintain a consistent coding style across different IDEs, the project contains `.editorconfig`
## Contributing
Contributions are more than welcome! Please check out the [contributing guide](CONTRIBUTING.md).
## Inspirations
- [RESTful API Node Server Boilerplate](https://github.com/hagopj13/node-express-boilerplate)
## License
[MIT](LICENSE)

View File

@@ -1,8 +0,0 @@
services:
node-app:
container_name: node-app-dev
# command: sleep infinity
command: yarn dev -L
ports:
- '3000:3000'
- '5555:5555'

View File

@@ -1,15 +0,0 @@
services:
db:
image: postgres
restart: always
container_name: postgresdb-util-dev
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=secret
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
volumes:
db:
driver: local

View File

@@ -1,15 +0,0 @@
services:
db:
image: postgres
restart: always
container_name: postgresdb-util-test
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=secret
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
volumes:
db:
driver: local

View File

@@ -1,5 +0,0 @@
services:
node-app:
container_name: node-app-prod
command: yarn start
restart: always

View File

@@ -1,4 +0,0 @@
services:
node-app:
container_name: node-app-test
command: yarn test

View File

@@ -1,46 +0,0 @@
volumes:
dbdata:
driver: local
networks:
node-network:
driver: bridge
services:
postgresdb:
image: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=secret
ports:
- '5432:5432'
volumes:
- dbdata:/var/lib/postgresql/data
networks:
- node-network
mailpit:
image: axllent/mailpit
ports:
- '1025:1025' # SMTP
- '8025:8025' # Web UI
environment:
MP_UI_AUTH: 'admin:password123' # Optional auth
MP_SMTP_AUTH: 'admin:password123'
MP_SMTP_AUTH_ALLOW_INSECURE: 'true'
networks:
- node-network
node-app:
build: .
image: node-app
ports:
- '3000:3000'
depends_on:
- postgresdb
- mailpit
volumes:
- .:/usr/src/node-app
networks:
- node-network

View File

@@ -1,15 +0,0 @@
{
"apps": [
{
"name": "app",
"script": "build/src/index.js",
"instances": 1,
"autorestart": true,
"watch": false,
"time": true,
"env": {
"NODE_ENV": "production"
}
}
]
}

View File

@@ -1,10 +0,0 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testEnvironmentOptions: {
NODE_ENV: 'test'
},
restoreMocks: true,
coveragePathIgnorePatterns: ['node_modules', 'src/config', 'src/app.ts', 'tests'],
coverageReporters: ['text', 'lcov', 'clover', 'html']
};

View File

@@ -1,115 +0,0 @@
{
"name": "prisma-express-typescript-boilerplate",
"version": "1.0.0",
"description": "REST API Boilerplate with Node JS, TypeScript, Express and Prisma",
"main": "src/index.ts",
"repository": "https://github.com/antonio-lazaro/prisma-express-typescript-boilerplate.git",
"scripts": {
"start": "yarn build && pm2 start ecosystem.config.json --no-daemon",
"dev": "cross-env NODE_ENV=development nodemon src/index.ts",
"test": "docker-compose -f docker-compose.only-db-test.yml up -d && yarn db:push && jest -i --colors --verbose --detectOpenHandles && docker-compose -f docker-compose.only-db-test.yml down",
"test:watch": "docker-compose -f docker-compose.only-db-test.yml up -d && yarn db:push && jest -i --watchAll && docker-compose -f docker-compose.only-db-test.yml down",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prettier": "prettier --check **/*.ts",
"prettier:fix": "prettier --write **/*.ts",
"db:generate": "prisma generate",
"db:push": "prisma db push --force-reset",
"db:push:w": "npx nodemon --delay 5 --ext \"ts,tsx,prisma\" --exec \"yarn db:push && yarn seed && yarn db:studio\"",
"db:studio": "prisma studio",
"docker:prod": "docker-compose -f docker-compose.yml -f docker-compose.prod.yml up",
"docker:build": "docker-compose -f docker-compose.yml -f docker-compose.dev.yml build",
"docker:dev": "docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d",
"docker:bash": "docker-compose -f docker-compose.yml -f docker-compose.dev.yml exec -it node-app sh",
"docker:test": "docker-compose -f docker-compose.yml -f docker-compose.test.yml up",
"docker:dev-db:start": "docker-compose -f docker-compose.only-db-dev.yml up -d",
"docker:dev-db:stop": "docker-compose -f docker-compose.only-db-dev.yml down",
"prepare": "husky install",
"build": "rimraf build && tsc -p tsconfig.json",
"seed": "ts-node prisma/seed.ts",
"seed:w": "yarn nodemon --ext ts,tsx --exec \"yarn run seed\""
},
"keywords": [
"node",
"node.js",
"typescript",
"boilerplate",
"express",
"rest",
"api",
"prisma",
"postgresql",
"es6",
"es7",
"es8",
"es9",
"docker",
"passport",
"joi",
"eslint",
"prettier"
],
"author": "Antonio Lázaro",
"license": "ISC",
"devDependencies": {
"@faker-js/faker": "^7.6.0",
"@jest/globals": "^29.3.1",
"@types/compression": "^1.7.2",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.14",
"@types/jest": "^29.2.5",
"@types/morgan": "^1.9.3",
"@types/node": "^18.11.13",
"@types/passport": "^1.0.11",
"@types/passport-jwt": "^3.0.7",
"@types/supertest": "^2.0.12",
"@types/swagger-jsdoc": "^6.0.1",
"@types/swagger-ui-express": "^4.1.3",
"@types/xss-filters": "^0.0.27",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"cross-env": "^7.0.3",
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.2",
"jest": "^29.3.1",
"lint-staged": "^13.1.0",
"node-mocks-http": "^1.12.1",
"nodemon": "^2.0.20",
"prettier": "^2.8.1",
"prisma": "^4.10.1",
"supertest": "^6.3.3",
"swagger-jsdoc": "^6.2.5",
"swagger-ui-express": "^4.6.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
},
"dependencies": {
"@prisma/client": "^4.10.1",
"@types/bcryptjs": "^2.4.2",
"@types/nodemailer": "^6.4.7",
"bcryptjs": "^2.4.3",
"compression": "^1.7.4",
"cors": "^2.8.5",
"date-fns": "^4.1.0",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"express-rate-limit": "^6.7.0",
"helmet": "^6.0.1",
"http-status": "^1.5.3",
"joi": "^17.7.0",
"moment": "^2.29.4",
"morgan": "^1.10.0",
"nodemailer": "^6.8.0",
"passport": "^0.6.0",
"passport-jwt": "^4.0.0",
"pm2": "^5.2.2",
"winston": "^3.8.2",
"xss-filters": "^1.2.7"
},
"prisma": {
"seed": "ts-node prisma/seed.ts"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +0,0 @@
import { Event } from './seeds/Event';
import { Member } from './seeds/Member';
import { Order } from './seeds/Order';
import { superuserSeed } from './seeds/superuser';
import { userSeed } from './seeds/user';
import { ProductReview } from './seeds/productReview';
import { ProductItem } from './seeds/productItem';
import { Blog } from './seeds/blog';
import { Mail } from './seeds/mail';
// import { File } from './seeds/_files';
// import { Chat } from './seeds/chat';
(async () => {
await userSeed;
await superuserSeed;
await Member;
await Event;
await Order;
await ProductReview;
await ProductItem;
await Blog;
await Mail;
// await File;
// await Chat;
})();

View File

@@ -1,39 +0,0 @@
import { PrismaClient } from '@prisma/client';
import { format, parseISO } from 'date-fns';
const prisma = new PrismaClient();
async function event() {
for (let i = 0; i < 5; i++) {
const helloworldEvent = await prisma.event.upsert({
where: { id: i },
update: {},
create: {
eventDate: new Date(),
joinMembers: undefined,
title: 'event ' + i,
price: 123 + i,
currency: 'HKD',
duration_m: 480 - i,
ageBottom: 12 + i,
ageTop: 48 - i,
location: 'Hong Kong Island',
avatar: 'https://www.ionics.io/img/ionic-logo.png'
}
});
}
console.log('seed event done');
}
const Event = event()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});
export { Event };

View File

@@ -1,46 +0,0 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function member() {
for (let i = 0; i < 100; i++) {
const john = await prisma.member.upsert({
where: { email: `member${i}@example.com` },
update: {},
create: {
email: `member${i}@example.com`,
name: `member_${i}`,
age: 20 + i,
rank: i % 2 ? 'VIP' : 'NON_VIP',
verified: i % 3 ? 'NOT_VERIFIED' : 'VERIFIED',
hobbies: ['fishing', 'basketball', 'piano'],
distance: '40km',
location_area: 'Sai Kung',
greetings: 'Hi, I am ',
gender: 'man',
tall_cm: 172,
weight_kg: 60,
occupation: 'doctor',
language: ['English', 'French', 'Chinese'],
education: ['Degree of Computer'],
self_introduction: 'Get me know me before you love me. Get me know me before you love me.',
music: ['Classic', 'Classic', 'Classic', 'Classic', 'Classic', 'Classic'],
pets: ['Classic', 'Classic', 'Classic', 'Classic', 'Classic', 'Classic'],
character: ['Classic', 'Classic', 'Classic', 'Classic', 'Classic', 'Classic']
}
});
}
console.log('seed member done');
}
const Member = member()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});
export { Member };

View File

@@ -1,31 +0,0 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function order() {
for (let i = 0; i < 3; i++) {
const temp = await prisma.order.upsert({
where: { id: i },
update: {},
create: {
title: 'Single Party with Dating',
order_time: new Date(),
last_payment_date: new Date(),
status: 'Pending'
}
});
}
console.log('seed order done');
}
const Order = order()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});
export { Order };

View File

@@ -1,49 +0,0 @@
// src/_mock/_files.ts
//
import { _mock } from './_mock';
import { _fileNames } from './assets';
// ----------------------------------------------------------------------
const GB = 1000000000 * 24;
const URLS = [
_mock.image.cover(2),
'https://www.cloud.com/s/c218bo6kjuqyv66/design_suriname_2015.mp3',
'https://www.cloud.com/s/c218bo6kjuqyv66/expertise_2015_conakry_sao-tome-and-principe_gender.mp4',
'https://www.cloud.com/s/c218bo6kjuqyv66/money-popup-crack.pdf',
_mock.image.cover(3),
_mock.image.cover(5),
'https://www.cloud.com/s/c218bo6kjuqyv66/large_news.txt',
'https://www.cloud.com/s/c218bo6kjuqyv66/nauru-6015-small-fighter-left-gender.psd',
'https://www.cloud.com/s/c218bo6kjuqyv66/tv-xs.doc',
'https://www.cloud.com/s/c218bo6kjuqyv66/gustavia-entertainment-productivity.docx',
'https://www.cloud.com/s/c218bo6kjuqyv66/vintage_bahrain_saipan.xls',
'https://www.cloud.com/s/c218bo6kjuqyv66/indonesia-quito-nancy-grace-left-glad.xlsx',
'https://www.cloud.com/s/c218bo6kjuqyv66/legislation-grain.zip',
'https://www.cloud.com/s/c218bo6kjuqyv66/large_energy_dry_philippines.rar',
'https://www.cloud.com/s/c218bo6kjuqyv66/footer-243-ecuador.iso',
'https://www.cloud.com/s/c218bo6kjuqyv66/kyrgyzstan-04795009-picabo-street-guide-style.ai',
'https://www.cloud.com/s/c218bo6kjuqyv66/india-data-large-gk-chesterton-mother.esp',
'https://www.cloud.com/s/c218bo6kjuqyv66/footer-barbados-celine-dion.ppt',
'https://www.cloud.com/s/c218bo6kjuqyv66/socio_respectively_366996.pptx',
'https://www.cloud.com/s/c218bo6kjuqyv66/socio_ahead_531437_sweden_popup.wav',
'https://www.cloud.com/s/c218bo6kjuqyv66/trinidad_samuel-morse_bring.m4v',
_mock.image.cover(11),
_mock.image.cover(17),
'https://www.cloud.com/s/c218bo6kjuqyv66/xl_david-blaine_component_tanzania_books.pdf'
];
// ----------------------------------------------------------------------
export const _files = () =>
_fileNames.map((name, index) => ({
id: _mock.id(index),
name,
path: URLS[index],
preview: URLS[index],
size: GB / ((index + 1) * 500),
createdAt: _mock.time(index),
modifiedAt: _mock.time(index),
type: `${name.split('.').pop()}`
}));

View File

@@ -1,88 +0,0 @@
import { fSub } from './utils/set-date';
import { CONFIG } from './global-config';
import {
_id,
_ages,
_roles,
_prices,
_emails,
_ratings,
_nativeS,
_nativeM,
_nativeL,
_percents,
_booleans,
_sentences,
_lastNames,
_fullNames,
_tourNames,
_jobTitles,
_taskNames,
_fileNames,
_postTitles,
_firstNames,
_eventNames,
_courseNames,
_fullAddress,
_companyNames,
_productNames,
_descriptions,
_phoneNumbers,
_countryNames
} from './assets';
// ----------------------------------------------------------------------
export const _mock = {
id: (index: number) => _id[index],
// time: (index: number) => `2024-06-${(index + 1).toString().padStart(2, '0')}T23:00:00.000Z`,
time: (index: number) => fSub({ days: index, hours: index }),
boolean: (index: number) => _booleans[index],
role: (index: number) => _roles[index],
// Text
courseNames: (index: number) => _courseNames[index],
fileNames: (index: number) => _fileNames[index],
eventNames: (index: number) => _eventNames[index],
taskNames: (index: number) => _taskNames[index],
postTitle: (index: number) => _postTitles[index],
jobTitle: (index: number) => _jobTitles[index],
tourName: (index: number) => _tourNames[index],
productName: (index: number) => _productNames[index],
sentence: (index: number) => _sentences[index],
description: (index: number) => _descriptions[index],
// Contact
email: (index: number) => _emails[index],
phoneNumber: (index: number) => _phoneNumbers[index],
fullAddress: (index: number) => _fullAddress[index],
// Name
firstName: (index: number) => _firstNames[index],
lastName: (index: number) => _lastNames[index],
fullName: (index: number) => _fullNames[index],
companyNames: (index: number) => _companyNames[index],
countryNames: (index: number) => _countryNames[index],
// Number
number: {
percent: (index: number) => _percents[index],
rating: (index: number) => _ratings[index],
age: (index: number) => _ages[index],
price: (index: number) => _prices[index],
nativeS: (index: number) => _nativeS[index],
nativeM: (index: number) => _nativeM[index],
nativeL: (index: number) => _nativeL[index]
},
// Image
image: {
cover: (index: number) => `${CONFIG.basePath}/assets/images/cover/cover-${index + 1}.webp`,
avatar: (index: number) => `${CONFIG.basePath}/assets/images/avatar/avatar-${index + 1}.webp`,
travel: (index: number) => `${CONFIG.basePath}/assets/images/travel/travel-${index + 1}.webp`,
course: (index: number) => `${CONFIG.basePath}/assets/images/course/course-${index + 1}.webp`,
company: (index: number) =>
`${CONFIG.basePath}/assets/images/company/company-${index + 1}.webp`,
product: (index: number) =>
`${CONFIG.basePath}/assets/images/m-product/product-${index + 1}.webp`,
portrait: (index: number) =>
`${CONFIG.basePath}/assets/images/portrait/portrait-${index + 1}.webp`
}
};

View File

@@ -1,674 +0,0 @@
// ----------------------------------------------------------------------
export const _id = Array.from(
{ length: 40 },
(_, index) => `e99f09a7-dd88-49d5-b1c8-1daf80c2d7b${index + 1}`
);
// ----------------------------------------------------------------------
export const _booleans = [
true,
true,
true,
false,
false,
true,
false,
false,
false,
false,
true,
true,
true,
false,
false,
false,
true,
false,
false,
false,
true,
false,
false,
true,
];
// ----------------------------------------------------------------------
export const _prices = [
83.74, 97.14, 68.71, 85.21, 52.17, 25.18, 43.84, 60.98, 98.42, 53.37, 72.75, 56.61, 64.55, 77.32,
60.62, 79.81, 93.68, 47.44, 76.24, 92.87, 72.91, 20.54, 94.25, 37.51,
];
export const _ratings = [
4.2, 3.7, 4.5, 3.5, 0.5, 3.0, 2.5, 2.8, 4.9, 3.6, 2.5, 1.7, 3.9, 2.8, 4.1, 4.5, 2.2, 3.2, 0.6,
1.3, 3.8, 3.8, 3.8, 2.0,
];
export const _ages = [
30, 26, 59, 47, 29, 46, 18, 56, 39, 19, 45, 18, 46, 56, 38, 41, 44, 48, 32, 45, 42, 60, 33, 57,
];
export const _percents = [
10.1, 13.6, 28.2, 42.1, 37.2, 18.5, 40.1, 94.8, 91.4, 53.0, 25.4, 62.9, 86.6, 62.4, 35.4, 17.6,
52.0, 6.8, 95.3, 26.6, 69.9, 92.1, 46.2, 85.6,
];
export const _nativeS = [
11, 10, 7, 10, 12, 5, 10, 1, 8, 8, 10, 11, 12, 8, 4, 11, 8, 9, 4, 9, 2, 6, 3, 7,
];
export const _nativeM = [
497, 763, 684, 451, 433, 463, 951, 194, 425, 435, 807, 521, 538, 839, 394, 269, 453, 821, 364,
849, 804, 776, 263, 239,
];
export const _nativeL = [
9911, 1947, 9124, 6984, 8488, 2034, 3364, 8401, 8996, 5271, 8478, 1139, 8061, 3035, 6733, 3952,
2405, 3127, 6843, 4672, 6995, 6053, 5192, 9686,
];
export const _fullAddress = [
`19034 Verna Unions Apt. 164 - Honolulu, RI / 87535`,
`1147 Rohan Drive Suite 819 - Burlington, VT / 82021`,
`18605 Thompson Circle Apt. 086 - Idaho Falls, WV / 50337`,
`110 Lamar Station Apt. 730 - Hagerstown, OK / 49808`,
`36901 Elmer Spurs Apt. 762 - Miramar, DE / 92836`,
`2089 Runolfsson Harbors Suite 886 - Chapel Hill, TX / 32827`,
`279 Karolann Ports Apt. 774 - Prescott Valley, WV / 53905`,
`96607 Claire Square Suite 591 - St. Louis Park, HI / 40802`,
`9388 Auer Station Suite 573 - Honolulu, AK / 98024`,
`47665 Adaline Squares Suite 510 - Blacksburg, NE / 53515`,
`989 Vernice Flats Apt. 183 - Billings, NV / 04147`,
`91020 Wehner Locks Apt. 673 - Albany, WY / 68763`,
`585 Candelario Pass Suite 090 - Columbus, LA / 25376`,
`80988 Renner Crest Apt. 000 - Fargo, VA / 24266`,
`28307 Shayne Pike Suite 523 - North Las Vegas, AZ / 28550`,
`205 Farrell Highway Suite 333 - Rock Hill, OK / 63421`,
`253 Kara Motorway Suite 821 - Manchester, SD / 09331`,
`13663 Kiara Oval Suite 606 - Missoula, AR / 44478`,
`8110 Claire Port Apt. 703 - Anchorage, TN / 01753`,
`4642 Demetris Lane Suite 407 - Edmond, AZ / 60888`,
`74794 Asha Flat Suite 890 - Lancaster, OR / 13466`,
`8135 Keeling Pines Apt. 326 - Alexandria, MA / 89442`,
`441 Gibson Shores Suite 247 - Pasco, NM / 60678`,
`4373 Emelia Valley Suite 596 - Columbia, NM / 42586`,
];
// ----------------------------------------------------------------------
export const _emails = [
`nannie.abernathy70@yahoo.com`,
`ashlynn.ohara62@gmail.com`,
`milo.farrell@hotmail.com`,
`violet.ratke86@yahoo.com`,
`letha.lubowitz24@yahoo.com`,
`aditya.greenfelder31@gmail.com`,
`lenna.bergnaum27@hotmail.com`,
`luella.ryan33@gmail.com`,
`joana.simonis84@gmail.com`,
`marjolaine.white94@gmail.com`,
`vergie.block82@hotmail.com`,
`vito.hudson@hotmail.com`,
`tyrel.greenholt@gmail.com`,
`dwight.block85@yahoo.com`,
`mireya13@hotmail.com`,
`dasia.jenkins@hotmail.com`,
`benny89@yahoo.com`,
`dawn.goyette@gmail.com`,
`zella.hickle4@yahoo.com`,
`avery43@hotmail.com`,
`olen.legros@gmail.com`,
`jimmie.gerhold73@hotmail.com`,
`genevieve.powlowski@hotmail.com`,
`louie.kuphal39@gmail.com`,
];
// ----------------------------------------------------------------------
export const _fullNames = [
`Jayvion Simon`,
`Lucian Obrien`,
`Deja Brady`,
`Harrison Stein`,
`Reece Chung`,
`Lainey Davidson`,
`Cristopher Cardenas`,
`Melanie Noble`,
`Chase Day`,
`Shawn Manning`,
`Soren Durham`,
`Cortez Herring`,
`Brycen Jimenez`,
`Giana Brandt`,
`Aspen Schmitt`,
`Colten Aguilar`,
`Angelique Morse`,
`Selina Boyer`,
`Lawson Bass`,
`Ariana Lang`,
`Amiah Pruitt`,
`Harold Mcgrath`,
`Esperanza Mcintyre`,
`Mireya Conner`,
];
export const _firstNames = [
`Mossie`,
`David`,
`Ebba`,
`Chester`,
`Eula`,
`Jaren`,
`Boyd`,
`Brady`,
`Aida`,
`Anastasia`,
`Gregoria`,
`Julianne`,
`Ila`,
`Elyssa`,
`Lucio`,
`Lewis`,
`Jacinthe`,
`Molly`,
`Brown`,
`Fritz`,
`Keon`,
`Ella`,
`Ken`,
`Whitney`,
];
export const _lastNames = [
`Carroll`,
`Simonis`,
`Yost`,
`Hand`,
`Emmerich`,
`Wilderman`,
`Howell`,
`Sporer`,
`Boehm`,
`Morar`,
`Koch`,
`Reynolds`,
`Padberg`,
`Watsica`,
`Upton`,
`Yundt`,
`Pfeffer`,
`Parker`,
`Zulauf`,
`Treutel`,
`McDermott`,
`McDermott`,
`Cruickshank`,
`Parisian`,
];
// ----------------------------------------------------------------------
export const _phoneNumbers = [
'+1 202-555-0143',
'+1 416-555-0198',
'+44 20 7946 0958',
'+61 2 9876 5432',
'+91 22 1234 5678',
'+49 30 123456',
'+33 1 23456789',
'+81 3 1234 5678',
'+86 10 1234 5678',
'+55 11 2345-6789',
'+27 11 123 4567',
'+7 495 123-4567',
'+52 55 1234 5678',
'+39 06 123 4567',
'+34 91 123 4567',
'+31 20 123 4567',
'+46 8 123 456',
'+41 22 123 45 67',
'+82 2 123 4567',
'+54 11 1234-5678',
'+64 9 123 4567',
'+65 1234 5678',
'+60 3-1234 5678',
'+66 2 123 4567',
'+62 21 123 4567',
'+63 2 123 4567',
'+90 212 123 45 67',
'+966 11 123 4567',
'+971 2 123 4567',
'+20 2 12345678',
'+234 1 123 4567',
'+254 20 123 4567',
'+972 3-123-4567',
'+30 21 1234 5678',
'+353 1 123 4567',
'+351 21 123 4567',
'+47 21 23 45 67',
'+45 32 12 34 56',
'+358 9 123 4567',
'+48 22 123 45 67',
];
// ----------------------------------------------------------------------
export const _countryNames = [
'United States',
'Canada',
'United Kingdom',
'Australia',
'India',
'Germany',
'France',
'Japan',
'China',
'Brazil',
'South Africa',
'Russia',
'Mexico',
'Italy',
'Spain',
'Netherlands',
'Sweden',
'Switzerland',
'South Korea',
'Argentina',
'New Zealand',
'Singapore',
'Malaysia',
'Thailand',
'Indonesia',
'Philippines',
'Turkey',
'Saudi Arabia',
'United Arab Emirates',
'Egypt',
'Nigeria',
'Kenya',
'Israel',
'Greece',
'Ireland',
'Portugal',
'Norway',
'Denmark',
'Finland',
'Poland',
];
// ----------------------------------------------------------------------
export const _roles = [
`CEO`,
`CTO`,
`Project Coordinator`,
`Team Leader`,
`Software Developer`,
`Marketing Strategist`,
`Data Analyst`,
`Product Owner`,
`Graphic Designer`,
`Operations Manager`,
`Customer Support Specialist`,
`Sales Manager`,
`HR Recruiter`,
`Business Consultant`,
`Financial Planner`,
`Network Engineer`,
`Content Creator`,
`Quality Assurance Tester`,
`Public Relations Officer`,
`IT Administrator`,
`Compliance Officer`,
`Event Planner`,
`Legal Counsel`,
`Training Coordinator`,
];
// ----------------------------------------------------------------------
export const _postTitles = [
`The Future of Renewable Energy: Innovations and Challenges Ahead`,
`Exploring the Impact of Artificial Intelligence on Modern Healthcare`,
`Climate Change and Its Effects on Global Food Security`,
`The Rise of Remote Work: Benefits, Challenges, and Future Trends`,
`Understanding Blockchain Technology: Beyond Cryptocurrency`,
`Mental Health in the Digital Age: Navigating Social Media and Well-being`,
`Sustainable Fashion: How the Industry is Going Green`,
`Space Exploration: New Frontiers and the Quest for Extraterrestrial Life`,
`The Evolution of E-Commerce: Trends Shaping the Online Retail Landscape`,
`Cybersecurity in the 21st Century: Protecting Data in a Digital World`,
`The Role of Big Data in Transforming Business Strategies`,
`Genetic Engineering: Ethical Considerations and Future Prospects`,
`Urban Farming: A Solution to Food Deserts and Urban Sustainability`,
`The Psychology of Consumer Behavior: What Drives Our Purchasing Decisions?`,
`Renewable Energy vs. Fossil Fuels: Which is the Future?`,
`Artificial Intelligence in Education: Enhancing Learning Experiences`,
`The Impact of Climate Change on Global Migration Patterns`,
`5G Technology: Revolutionizing Connectivity and Communication`,
`The Gig Economy: Opportunities, Risks, and the Future of Work`,
`Smart Cities: Integrating Technology for Sustainable Urban Living`,
`The Influence of Pop Culture on Modern Society`,
`Innovations in Medicine: From Telehealth to Personalized Treatment`,
`The Environmental Cost of Fast Fashion: What Can Consumers Do?`,
`The Intersection of Art and Technology: Digital Art in the 21st Century`,
];
// ----------------------------------------------------------------------
export const _productNames = [
`Urban Explorer Sneakers`,
`Classic Leather Loafers`,
`Mountain Trekking Boots`,
`Elegance Stiletto Heels`,
`Comfy Running Shoes`,
`Chic Ballet Flats`,
`Vintage Oxford Shoes`,
`Waterproof Hiking Boots`,
`Casual Slip-On Sneakers`,
`Premium Dress Shoes`,
`Sporty Trail Runners`,
`Sophisticated Brogues`,
`Beach Sandals`,
`Stylish Wedge Heels`,
`Lightweight Training Shoes`,
`Luxurious Moccasins`,
`Durable Work Boots`,
`Trendy Platform Sneakers`,
`Cozy Winter Boots`,
`Fashion Ankle Boots`,
`Breathable Tennis Shoes`,
`Elegant Evening Pumps`,
`Modern Skate Shoes`,
`Comfortable Walking Shoes`,
];
// ----------------------------------------------------------------------
export const _tourNames = [
`Majestic Mountain Adventures`,
`Island Hopping Extravaganza`,
`Cultural Wonders of Europe`,
`Safari Expedition in Africa`,
`Grand Canyon Explorer`,
`Historic Cities of Asia`,
`Tropical Paradise Getaway`,
`Alaskan Wilderness Tour`,
`Mediterranean Cruise Voyage`,
`Enchanting Eastern Europe`,
`Scenic Coastal Road Trip`,
`Ancient Ruins Discovery`,
`Australian Outback Adventure`,
`Northern Lights Experience`,
`Wildlife Wonders of South America`,
`Royal Castles and Palaces`,
`Ultimate Beach Retreat`,
`National Parks Exploration`,
`Gastronomic Tour of Italy`,
`Hiking Trails of New Zealand`,
`Art and History of France`,
`Exotic Temples of India`,
`Canadian Rockies Journey`,
`Caribbean Sun and Fun`,
];
// ----------------------------------------------------------------------
export const _jobTitles = [
`Software Engineer`,
`Marketing Manager`,
`Data Scientist`,
`Graphic Designer`,
`Financial Analyst`,
`Human Resources Specialist`,
`Project Manager`,
`Sales Executive`,
`Content Writer`,
`Network Administrator`,
`Customer Service Representative`,
`Product Manager`,
`Business Analyst`,
`Mechanical Engineer`,
`Operations Manager`,
`UX/UI Designer`,
`Accountant`,
`Social Media Manager`,
`Research Scientist`,
`Legal Advisor`,
`Public Relations Specialist`,
`Health and Safety Officer`,
`IT Support Specialist`,
`Environmental Consultant`,
];
// ----------------------------------------------------------------------
export const _companyNames = [
`Lueilwitz and Sons`,
`Gleichner, Mueller and Tromp`,
`Nikolaus - Leuschke`,
`Hegmann, Kreiger and Bayer`,
`Grimes Inc`,
`Durgan - Murazik`,
`Altenwerth, Medhurst and Roberts`,
`Raynor Group`,
`Mraz, Donnelly and Collins`,
`Padberg - Bailey`,
`Heidenreich, Stokes and Parker`,
`Pagac and Sons`,
`Rempel, Hand and Herzog`,
`Dare - Treutel`,
`Kihn, Marquardt and Crist`,
`Nolan - Kunde`,
`Wuckert Inc`,
`Dibbert Inc`,
`Goyette and Sons`,
`Feest Group`,
`Bosco and Sons`,
`Bartell - Kovacek`,
`Schimmel - Raynor`,
`Tremblay LLC`,
];
// ----------------------------------------------------------------------
export const _tags = [
`Technology`,
`Health and Wellness`,
`Travel`,
`Finance`,
`Education`,
`Food and Beverage`,
`Fashion`,
`Home and Garden`,
`Sports`,
`Entertainment`,
`Business`,
`Science`,
`Automotive`,
`Beauty`,
`Fitness`,
`Lifestyle`,
`Real Estate`,
`Parenting`,
`Pet Care`,
`Environmental`,
`DIY and Crafts`,
`Gaming`,
`Photography`,
`Music`,
];
// ----------------------------------------------------------------------
export const _taskNames = [
`Prepare Monthly Financial Report`,
`Design New Marketing Campaign`,
`Analyze Customer Feedback`,
`Update Website Content`,
`Conduct Market Research`,
`Develop Software Application`,
`Organize Team Meeting`,
`Create Social Media Posts`,
`Review Project Plan`,
`Implement Security Protocols`,
`Write Technical Documentation`,
`Test New Product Features`,
`Manage Client Inquiries`,
`Train New Employees`,
`Coordinate Logistics`,
`Monitor Network Performance`,
`Develop Training Materials`,
`Draft Press Release`,
`Prepare Budget Proposal`,
`Evaluate Vendor Proposals`,
`Perform Data Analysis`,
`Conduct Quality Assurance`,
`Plan Event Logistics`,
`Optimize SEO Strategies`,
];
// ----------------------------------------------------------------------
export const _courseNames = [
`Introduction to Python Programming`,
`Digital Marketing Fundamentals`,
`Data Science with R`,
`Graphic Design Essentials`,
`Financial Planning for Beginners`,
`Human Resource Management Basics`,
`Project Management Fundamentals`,
`Sales Techniques and Strategies`,
`Content Writing Mastery`,
`Network Security Fundamentals`,
`Customer Service Excellence`,
`Product Management Essentials`,
`Business Analytics with Excel`,
`Mechanical Engineering Principles`,
`Leadership and Team Management`,
`User Experience (UX) Design Basics`,
`Accounting Fundamentals`,
`Social Media Marketing Mastery`,
`Biotechnology Essentials`,
`Legal Studies for Non-Lawyers`,
`Public Speaking Confidence`,
`Health and Wellness Coaching`,
`Web Development Bootcamp`,
`Photography Masterclass`,
];
// ----------------------------------------------------------------------
export const _fileNames = [
'cover-2.jpg',
'design-suriname-2015.mp3',
'expertise-2015-conakry-sao-tome-and-principe-gender.mp4',
'money-popup-crack.pdf',
'cover-4.jpg',
'cover-6.jpg',
'large-news.txt',
'nauru-6015-small-fighter-left-gender.psd',
'tv-xs.doc',
'gustavia-entertainment-productivity.docx',
'vintage-bahrain-saipan.xls',
'indonesia-quito-nancy-grace-left-glad.xlsx',
'legislation-grain.zip',
'large-energy-dry-philippines.rar',
'footer-243-ecuador.iso',
'kyrgyzstan-04795009-picabo-street-guide-style.ai',
'india-data-large-gk-chesterton-mother.esp',
'footer-barbados-celine-dion.ppt',
'socio-respectively-366996.pptx',
'socio-ahead-531437-sweden-popup.wav',
'trinidad-samuel-morse-bring.m4v',
'cover-12.jpg',
'cover-18.jpg',
'xl-david-blaine-component-tanzania-books.pdf',
];
export const _eventNames = [
`Annual General Meeting`,
`Summer Music Festival`,
`Tech Innovators Conference`,
`Charity Gala Dinner`,
`Spring Art Exhibition`,
`Corporate Training Workshop`,
`Community Health Fair`,
`Startup Pitch Night`,
`Regional Sports Tournament`,
`Book Launch Event`,
`Film Premiere Screening`,
`Industry Networking Mixer`,
`Holiday Craft Fair`,
`Environmental Awareness Week`,
`New Year's Eve Party`,
`Product Release Showcase`,
`Cultural Heritage Festival`,
`Science and Technology Expo`,
`Annual Awards Ceremony`,
`Fashion Week Runway Show`,
`Food and Wine Tasting`,
`Outdoor Adventure Camp`,
`Leadership Summit`,
`Wedding Expo`,
];
// ----------------------------------------------------------------------
export const _sentences = [
`The sun slowly set over the horizon, painting the sky in vibrant hues of orange and pink.`,
`She eagerly opened the gift, her eyes sparkling with excitement.`,
`The old oak tree stood tall and majestic, its branches swaying gently in the breeze.`,
`The aroma of freshly brewed coffee filled the air, awakening my senses.`,
`The children giggled with joy as they ran through the sprinklers on a hot summer day.`,
`He carefully crafted a beautiful sculpture out of clay, his hands skillfully shaping the intricate details.`,
`The concert was a mesmerizing experience, with the music filling the venue and the crowd cheering in delight.`,
`The waves crashed against the shore, creating a soothing symphony of sound.`,
`The scent of blooming flowers wafted through the garden, creating a fragrant paradise.`,
`She gazed up at the night sky, marveling at the twinkling stars that dotted the darkness.`,
`The professor delivered a captivating lecture, engaging the students with thought-provoking ideas.`,
`The hiker trekked through the dense forest, guided by the soft glow of sunlight filtering through the trees.`,
`The delicate butterfly gracefully fluttered from flower to flower, sipping nectar with its slender proboscis.`,
`The aroma of freshly baked cookies filled the kitchen, tempting everyone with its irresistible scent.`,
'The majestic waterfall cascaded down the rocks, creating a breathtaking display of nature`s power.',
`The actor delivered a powerful performance, moving the audience to tears with his emotional portrayal.`,
`The book transported me to a magical world, where imagination knew no bounds.`,
`The scent of rain filled the air as dark clouds gathered overhead, promising a refreshing downpour.`,
`The chef skillfully plated the dish, turning simple ingredients into a work of culinary art.`,
`The newborn baby let out a tiny cry, announcing its arrival to the world.`,
`The athlete sprinted across the finish line, arms raised in victory as the crowd erupted in applause.`,
`The ancient ruins stood as a testament to a civilization long gone, their grandeur still awe-inspiring.`,
`The artist dipped the brush into vibrant paint, bringing the canvas to life with bold strokes and vivid colors.`,
`The laughter of children echoed through the playground, filling the atmosphere with pure joy.`,
];
// ----------------------------------------------------------------------
export const _descriptions = [
`Occaecati est et illo quibusdam accusamus qui. Incidunt aut et molestiae ut facere aut. Est quidem iusto praesentium excepturi harum nihil tenetur facilis. Ut omnis voluptates nihil accusantium doloribus eaque debitis.`,
`Atque eaque ducimus minima distinctio velit. Laborum et veniam officiis. Delectus ex saepe hic id laboriosam officia. Odit nostrum qui illum saepe debitis ullam. Laudantium beatae modi fugit ut. Dolores consequatur beatae nihil voluptates rem maiores.`,
`Rerum eius velit dolores. Explicabo ad nemo quibusdam. Voluptatem eum suscipit et ipsum et consequatur aperiam quia. Rerum nulla sequi recusandae illum velit quia quas. Et error laborum maiores cupiditate occaecati.`,
`Et non omnis qui. Qui sunt deserunt dolorem aut velit cumque adipisci aut enim. Nihil quis quisquam nesciunt dicta nobis ab aperiam dolorem repellat. Voluptates non blanditiis. Error et tenetur iste soluta cupiditate ratione perspiciatis et. Quibusdam aliquid nam sunt et quisquam non esse.`,
`Nihil ea sunt facilis praesentium atque. Ab animi alias sequi molestias aut velit ea. Sed possimus eos. Et est aliquid est voluptatem.`,
`Non rerum modi. Accusamus voluptatem odit nihil in. Quidem et iusto numquam veniam culpa aperiam odio aut enim. Quae vel dolores. Pariatur est culpa veritatis aut dolorem.`,
`Est enim et sit non impedit aperiam cumque animi. Aut eius impedit saepe blanditiis. Totam molestias magnam minima fugiat.`,
`Unde a inventore et. Sed esse ut. Atque ducimus quibusdam fuga quas id qui fuga.`,
`Eaque natus adipisci soluta nostrum dolorem. Nesciunt ipsum molestias ut aliquid natus ut omnis qui fugiat. Dolor et rem. Ut neque voluptatem blanditiis quasi ullam deleniti.`,
`Nam et error exercitationem qui voluptate optio. Officia omnis qui accusantium ipsam qui. Quia sequi nulla perspiciatis optio vero omnis maxime omnis ipsum. Perspiciatis consequuntur asperiores veniam dolores.`,
`Perspiciatis nulla ut ut ut voluptates totam consectetur eligendi qui. Optio ut cum. Dolorum sapiente qui laborum. Impedit temporibus totam delectus nihil. Voluptatem corrupti rem.`,
`Distinctio omnis similique omnis eos. Repellat cumque rerum nisi. Reiciendis soluta non ut veniam temporibus. Accusantium et dolorem voluptas harum. Nemo eius voluptate dicta et hic nemo. Dolorem assumenda et beatae molestias sit quo mollitia quis consequatur.`,
`Sed ut mollitia tempore ipsam et illum doloribus ut. Occaecati ratione veritatis explicabo. Omnis nam omnis sunt placeat tempore accusantium placeat distinctio velit.`,
`Eum illo dicta et perspiciatis ut blanditiis eos sequi. Ea veritatis aut et voluptas aut. Laborum eos quia tempore a culpa.`,
`Aut quos quae dolores repudiandae similique perferendis perferendis earum laudantium. Facere placeat natus nobis. Eius vitae ullam dolorem.`,
`Vero dolorem et voluptatem fugit tempore a quam iure. Fuga consequatur corrupti sunt asperiores vitae. Libero totam repellendus animi debitis illum et sunt officia.`,
`Cupiditate illum officiis id molestiae. Numquam non molestiae aliquid et natus sed hic. Alias quia explicabo sed corrupti sint. Natus in et odio qui unde facilis quia. Est sit eius laboriosam aliquid non aperiam quia quo corporis.`,
`Et a ab. Optio aspernatur minus tempora amet vitae consectetur inventore cumque. Sed et omnis. Aspernatur a magnam.`,
`Ipsum omnis et. Quia ea et autem tempore consequuntur veniam dolorem officiis. Ipsa dicta et ut quidem quia doloremque. Sequi vitae doloremque temporibus. Deserunt incidunt id aperiam itaque natus. Earum sit eaque quas incidunt nihil.`,
`Quae consequatur reiciendis. Consequatur non optio. Eaque id placeat. Commodi quo officia aut repudiandae reiciendis tempore voluptatem et. Ut accusamus qui itaque maxime aliquam. Fugit ut animi molestiae porro maiores.`,
`Modi hic asperiores ab cumque quam est aut. Voluptas atque quos molestias. Ut excepturi distinctio ipsam aspernatur sit.`,
`Sunt totam facilis. Quam commodi voluptatem veniam. Tempora deleniti itaque fugit nihil voluptas.`,
`Ipsam aliquam velit nobis repellendus officiis aut deserunt id et. Nihil sunt aut dolores aut. Dolores est ipsa quia et laborum quidem laborum accusamus id. Facilis odit quod hic laudantium saepe omnis nisi in sint. Sed cupiditate possimus id.`,
`Magnam non eveniet optio optio ut aliquid atque. Velit libero aspernatur quis laborum consequatur laudantium. Tempora facere optio fugit accusantium ut. Omnis aspernatur reprehenderit autem esse ut ut enim voluptatibus.`,
];

View File

@@ -1,222 +0,0 @@
// src/_mock/_blog.ts
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
import { uuidv4 } from './utils/uuidv4';
import { _mock } from './_mock';
import { CONFIG } from './global-config';
import { _tags } from './assets';
const codeBlock = `
<pre class="nml__editor__content__code__block"><code class="language-javascript">for (var i=1; i &lt;= 20; i++) {\n if (i % 15 == 0)\n return "FizzBuzz"\n else if (i % 3 == 0)\n return "Fizz"\n else if (i % 5 == 0)\n return "Buzz"\n else\n return i\n }</code></pre>
`;
// Made with Tiptap editor
const CONTENT = `
<h1 class="nml__editor__content__heading" style="text-align: start">Heading H1</h1>
<h2 class="nml__editor__content__heading" style="text-align: start">Heading H2</h2>
<h3 class="nml__editor__content__heading" style="text-align: start">Heading H3</h3>
<h4 class="nml__editor__content__heading" style="text-align: start">Heading H4</h4>
<h5 class="nml__editor__content__heading" style="text-align: start">Heading H5</h5>
<h6 class="nml__editor__content__heading" style="text-align: start">Heading H6</h6>
<hr class="nml__editor__content__hr">
<h4 class="nml__editor__content__heading" style="text-align: start">Paragraph</h4>
<p style="text-align: start">What is MTAweb Directory?</p>
<p style="text-align: start">So you have heard about this site or you have been to it, but you cannot figure out what it is or what it can do. MTA web directory is the simplest way in which one can bid on a link, or a few links if they wish to do so. The link directory on MTA displays all of the links it currently has, and does so in alphabetical order, which makes it much easier for someone to find what they are looking for if it is something specific and they do not want to go through all the other sites and links as well. It allows you to start your bid at the bottom and slowly work your way to the top of the list.</p>
<p style="text-align: start">With a very low costing starting bid of just $1, you are guaranteed to have a spot in MTAs successful directory list. When you would like to increase your bid to one of the top positions, you have to know that this would be a wise decision to make as it will not only get your link to be at a higher point in the directory but it will also give you a chance to have your site advertised with the rest of the top ten on the home page of the website. This means that when visitors come to <a target="_blank" rel="noopener noreferrer nofollow" class="nml__editor__content__link" href="http://MTAweb.com">MTAweb.com</a>, your site will be one of the first things they see. In other words, you stand a great chance at getting a comeback to your site sooner than you thought.</p>
<p style="text-align: start"><strong>This is strong text.</strong></p>
<p style="text-align: start"><em>This is italic text</em></p>
<p style="text-align: start">This is underline text</p>
<h4 class="nml__editor__content__heading" style="text-align: start">Unordered list</h4>
<ul class="nml__editor__content__bullet__list">
<li class="nml__editor__content__listItem">
<p>Implements <a target="_blank" rel="noopener noreferrer nofollow" class="nml__editor__content__link" href="https://docs-minimals.vercel.app/introduction">This is an external link</a></p>
</li>
<li class="nml__editor__content__listItem">
<p>Implements <a target="_blank" rel="noopener noreferrer nofollow" class="nml__editor__content__link" href="https://codebeautify.org/dashboard/blog">This is an inside link</a></p>
</li>
<li class="nml__editor__content__listItem">
<p>Renders actual, "native" React DOM elements</p>
</li>
<li class="nml__editor__content__listItem">
<p>Allows you to escape or skip HTML (try toggling the checkboxes above)</p>
</li>
<li class="nml__editor__content__listItem">
<p>If you escape or skip the HTML, no dangerouslySetInnerHTML is used! Yay!</p>
</li>
</ul>
<h4 class="nml__editor__content__heading" style="text-align: start">Ordered list</h4>
<ol class="nml__editor__content__ordered__list">
<li class="nml__editor__content__listItem">
<p>Analysis</p>
</li>
<li class="nml__editor__content__listItem">
<p>Design</p>
</li>
<li class="nml__editor__content__listItem">
<p>Implementation</p>
</li>
</ol>
<h4 class="nml__editor__content__heading" style="text-align: start">Blockquote</h4>
<blockquote class="nml__editor__content__blockquote">
<p>Life is short, Smile while you still have teeth!&nbsp;</p>
</blockquote>
<h4 class="nml__editor__content__heading" style="text-align: start"><br>Block code</h4>
${codeBlock}
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<h5 class="nml__editor__content__heading" style="text-align: start">Why do we use it?</h5>
<p style="text-align: start">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
<img class="nml__editor__content__image" src="${CONFIG.basePath}/assets/images/cover/cover-5.webp">
<p>It is important that you buy links because the links are what get you the results that you want. The popularity of the links that are listed in the MTA directory is in fact one of the most important factors in the performance of the search engine. Links are important and this is why you have to purchase a link in order to bid on something and the best part is that a link will only cost you $1, which is nothing compared to what you would pay if you decided to do it through any other company or website.</p>
<img class="nml__editor__content__image" src="${CONFIG.basePath}/assets/images/cover/cover-14.webp">
`;
const generateComments = () => {
const userList = Array.from({ length: 12 }, (_, index) => ({
id: _mock.id(index),
name: _mock.fullName(index),
avatarUrl: _mock.image.avatar(index)
}));
return [
{
// id: uuidv4(),
name: userList[0].name,
avatarUrl: userList[0].avatarUrl,
message: _mock.sentence(1),
postedAt: _mock.time(1),
users: [userList[0], userList[1], userList[2]],
replyComment: [
{
id: uuidv4(),
userId: userList[1].id,
message: _mock.sentence(2),
postedAt: _mock.time(2)
},
{
id: uuidv4(),
userId: userList[0].id,
message: _mock.sentence(3),
tagUser: userList[1].name,
postedAt: _mock.time(3)
},
{
id: uuidv4(),
userId: userList[2].id,
message: _mock.sentence(4),
postedAt: _mock.time(4)
}
]
},
{
// id: uuidv4(),
name: userList[4].name,
avatarUrl: userList[4].avatarUrl,
message: _mock.sentence(5),
postedAt: _mock.time(5),
users: [userList[5], userList[6], userList[7]],
replyComment: [
{
id: uuidv4(),
userId: userList[5].id,
message: _mock.sentence(6),
postedAt: _mock.time(6)
},
{
id: uuidv4(),
userId: userList[6].id,
message: _mock.sentence(7),
postedAt: _mock.time(7)
},
{
id: uuidv4(),
userId: userList[7].id,
message: _mock.sentence(8),
postedAt: _mock.time(8)
}
]
},
{
// id: uuidv4(),
name: userList[8].name,
avatarUrl: userList[8].avatarUrl,
message: _mock.sentence(9),
postedAt: _mock.time(9),
users: [],
replyComment: []
},
{
// id: uuidv4(),
name: userList[9].name,
avatarUrl: userList[9].avatarUrl,
message: _mock.sentence(10),
postedAt: _mock.time(10),
users: [],
replyComment: []
}
];
};
const _posts = () =>
Array.from({ length: 19 }, (_, index) => {
const comments = generateComments();
const publish = index % 3 ? 'published' : 'draft';
const metaKeywords = _tags.slice(8, 11);
return {
// id: _mock.id(index),
publish,
metaKeywords,
content: CONTENT,
tags: _tags.slice(0, 5),
metaTitle: 'Minimal UI Kit',
createdAt: _mock.time(index),
title: _mock.postTitle(index),
coverUrl: _mock.image.cover(index),
totalViews: _mock.number.nativeL(index),
totalShares: _mock.number.nativeL(index + 2),
totalComments: _mock.number.nativeL(index + 1),
totalFavorites: _mock.number.nativeL(index + 3),
metaDescription: 'The starting point for your next project with Minimal UI Kit',
description: `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. `,
author: {
name: _mock.fullName(index),
avatarUrl: _mock.image.avatar(index)
},
favoritePerson: Array.from({ length: 20 }, (__, personIndex) => ({
name: _mock.fullName(personIndex),
avatarUrl: _mock.image.avatar(personIndex)
})),
//
comments: {
create: comments
}
};
});
const temp_posts = _posts();
async function blog() {
for (let i = 0; i < temp_posts.length; i++) {
await prisma.postItem.upsert({
where: { id: i },
update: {},
create: temp_posts[i]
});
}
console.log('generate blog-postitem done');
}
const Blog = blog()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});
export { Blog };

View File

@@ -1,592 +0,0 @@
// src/_mock/_blog.ts
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
import { uuidv4 } from './utils/uuidv4';
import { _mock } from './_mock';
import { CONFIG } from './global-config';
import { _tags } from './assets';
import { fSub } from './utils/set-date';
import { fileList } from './_files.ts';
export const _contacts = () =>
Array.from({ length: 20 }, (_, index) => ({
id: _mock.id(index),
role: _mock.role(index),
email: _mock.email(index),
name: _mock.fullName(index),
lastActivity: _mock.time(index),
address: _mock.fullAddress(index),
avatarUrl: _mock.image.avatar(index),
phoneNumber: _mock.phoneNumber(index),
status:
([0, 1, 6, 12].includes(index) && 'online') ||
([3, 8, 14].includes(index) && 'offline') ||
([4, 10, 16].includes(index) && 'busy') ||
'always'
}));
export const _conversations = () => {
const myContact = {
id: '8864c717-587d-472a-929a-8e5f298024da-0',
role: 'admin',
status: 'online',
name: 'Jaydon Frankie',
email: 'demo@minimals.cc',
phoneNumber: '+40 777666555',
address: '90210 Broadway Blvd',
avatarUrl: _mock.image.avatar(24),
lastActivity: fSub({ minutes: 1 })
};
const files = fileList();
const otherContacts = _contacts();
return [
{
id: otherContacts[1].id,
participants: [myContact, otherContacts[1]],
type: 'ONE_TO_ONE',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: otherContacts[1].id,
body: _mock.sentence(1),
contentType: 'text',
attachments: files.slice(0, 1),
createdAt: fSub({ hours: 5 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(2),
contentType: 'text',
attachments: files.slice(1, 2),
createdAt: fSub({ hours: 4 })
},
{
id: uuidv4(),
senderId: otherContacts[1].id,
body: _mock.sentence(3),
contentType: 'text',
attachments: files.slice(2, 3),
createdAt: fSub({ hours: 3 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(4),
contentType: 'text',
attachments: files.slice(3, 6),
createdAt: fSub({ hours: 2 })
},
{
id: uuidv4(),
senderId: otherContacts[1].id,
body: _mock.sentence(5),
contentType: 'text',
attachments: files.slice(6, 10),
createdAt: fSub({ hours: 1 })
},
{
id: uuidv4(),
senderId: otherContacts[1].id,
attachments: [],
contentType: 'image',
body: _mock.image.cover(4),
createdAt: fSub({ minutes: 15 })
},
{
id: uuidv4(),
senderId: myContact.id,
contentType: 'text',
attachments: [],
body: _mock.sentence(6),
createdAt: fSub({ minutes: 1 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(7),
contentType: 'text',
attachments: [],
createdAt: fSub({ minutes: 0 })
}
]
},
{
id: otherContacts[2].id,
participants: [myContact, otherContacts[2]],
type: 'ONE_TO_ONE',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: otherContacts[2].id,
body: _mock.sentence(2),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 6 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(3),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 5 })
},
{
id: uuidv4(),
senderId: otherContacts[2].id,
body: _mock.sentence(4),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 4 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(5),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 7 })
},
{
id: uuidv4(),
senderId: otherContacts[2].id,
body: _mock.sentence(6),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 3 })
},
{
id: uuidv4(),
senderId: otherContacts[2].id,
body: _mock.image.cover(7),
attachments: [],
contentType: 'image',
createdAt: fSub({ hours: 2 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(8),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 1 })
}
]
},
{
id: otherContacts[3].id,
participants: [myContact, otherContacts[3]],
type: 'ONE_TO_ONE',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: otherContacts[3].id,
body: _mock.sentence(3),
contentType: 'text',
attachments: files.slice(0, 1),
createdAt: fSub({ hours: 8 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(4),
contentType: 'text',
attachments: files.slice(1, 2),
createdAt: fSub({ hours: 7 })
},
{
id: uuidv4(),
senderId: otherContacts[3].id,
body: _mock.sentence(5),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 6 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(6),
contentType: 'text',
attachments: files.slice(2, 4),
createdAt: fSub({ hours: 5 })
},
{
id: uuidv4(),
senderId: otherContacts[3].id,
body: _mock.sentence(7),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 4 })
},
{
id: uuidv4(),
senderId: otherContacts[3].id,
body: _mock.image.cover(8),
contentType: 'image',
attachments: [],
createdAt: fSub({ hours: 3 })
},
{
id: uuidv4(),
senderId: otherContacts[3].id,
body: _mock.image.cover(9),
contentType: 'image',
attachments: [],
createdAt: fSub({ hours: 2 })
}
]
},
{
id: otherContacts[4].id,
participants: [myContact, otherContacts[4]],
type: 'ONE_TO_ONE',
unreadCount: 8,
messages: [
{
id: uuidv4(),
senderId: otherContacts[4].id,
body: _mock.sentence(4),
contentType: 'text',
attachments: files.slice(2, 4),
createdAt: fSub({ hours: 4 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(5),
contentType: 'text',
attachments: files.slice(4, 6),
createdAt: fSub({ hours: 3 })
},
{
id: uuidv4(),
senderId: otherContacts[4].id,
body: _mock.sentence(6),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 2 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(7),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 1 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(8),
contentType: 'text',
attachments: files.slice(6, 10),
createdAt: fSub({ minutes: 45 })
},
{
id: uuidv4(),
senderId: otherContacts[4].id,
body: _mock.sentence(9),
contentType: 'text',
attachments: [],
createdAt: fSub({ minutes: 5 })
}
]
},
{
id: otherContacts[5].id,
participants: [myContact, otherContacts[5]],
type: 'ONE_TO_ONE',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(5),
contentType: 'text',
attachments: [],
createdAt: fSub({ minutes: 5 })
},
{
id: uuidv4(),
senderId: otherContacts[5].id,
body: _mock.sentence(6),
contentType: 'text',
attachments: [],
createdAt: fSub({ seconds: 30 })
}
]
},
{
id: otherContacts[6].id,
participants: [myContact, otherContacts[6]],
type: 'ONE_TO_ONE',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(6),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 2 })
},
{
id: uuidv4(),
senderId: otherContacts[6].id,
body: _mock.sentence(7),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 1 })
}
]
},
{
id: `${_mock.id(1)}gr`,
participants: [myContact, ...otherContacts.slice(6, 11)],
type: 'GROUP',
unreadCount: 2,
messages: [
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(6),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 5 })
},
{
id: uuidv4(),
senderId: otherContacts[9].id,
body: _mock.sentence(7),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 4 })
},
{
id: uuidv4(),
senderId: otherContacts[10].id,
body: _mock.sentence(8),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 3 })
},
{
id: uuidv4(),
senderId: otherContacts[8].id,
body: _mock.sentence(9),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 2 })
},
{
id: uuidv4(),
senderId: myContact.id,
attachments: [],
body: _mock.sentence(10),
contentType: 'text',
createdAt: fSub({ hours: 1 })
},
{
id: uuidv4(),
senderId: otherContacts[6].id,
body: _mock.sentence(11),
contentType: 'text',
attachments: [],
createdAt: fSub({ minutes: 5 })
},
{
id: uuidv4(),
senderId: otherContacts[7].id,
body: _mock.sentence(12),
contentType: 'text',
attachments: [],
createdAt: fSub({ seconds: 30 })
}
]
},
{
id: otherContacts[7].id,
participants: [myContact, otherContacts[7]],
type: 'ONE_TO_ONE',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(7),
contentType: 'text',
attachments: [],
createdAt: fSub({ days: 4 })
},
{
id: uuidv4(),
senderId: otherContacts[7].id,
body: _mock.sentence(8),
contentType: 'text',
attachments: [],
createdAt: fSub({ days: 3 })
}
]
},
{
id: otherContacts[8].id,
participants: [myContact, otherContacts[8]],
type: 'ONE_TO_ONE',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(8),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 9 })
},
{
id: uuidv4(),
senderId: otherContacts[8].id,
body: _mock.sentence(9),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 8 })
}
]
},
{
id: otherContacts[9].id,
participants: [myContact, otherContacts[9]],
type: 'ONE_TO_ONE',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(9),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 5 })
},
{
id: uuidv4(),
senderId: otherContacts[9].id,
body: _mock.sentence(10),
contentType: 'text',
attachments: [],
createdAt: fSub({ hours: 3 })
}
]
},
{
id: `${_mock.id(2)}gr`,
participants: [myContact, ...otherContacts.slice(1, 5)],
type: 'GROUP',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(1),
contentType: 'text',
attachments: files.slice(0, 5),
createdAt: fSub({ hours: 4 })
},
{
id: uuidv4(),
senderId: otherContacts[1].id,
body: _mock.sentence(2),
contentType: 'text',
attachments: files.slice(5, 6),
createdAt: fSub({ hours: 3 })
},
{
id: uuidv4(),
senderId: otherContacts[2].id,
body: _mock.sentence(3),
contentType: 'text',
attachments: files.slice(6, 7),
createdAt: fSub({ hours: 2 })
},
{
id: uuidv4(),
senderId: otherContacts[4].id,
body: _mock.sentence(4),
contentType: 'text',
attachments: files.slice(7, 8),
createdAt: fSub({ hours: 1 })
},
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(5),
contentType: 'text',
attachments: files.slice(8, 9),
createdAt: fSub({ minutes: 30 })
},
{
id: uuidv4(),
senderId: otherContacts[3].id,
body: _mock.sentence(6),
contentType: 'text',
attachments: files.slice(9, 10),
createdAt: fSub({ minutes: 10 })
}
]
},
{
id: otherContacts[10].id,
participants: [myContact, otherContacts[10]],
type: 'ONE_TO_ONE',
unreadCount: 0,
messages: [
{
id: uuidv4(),
senderId: myContact.id,
body: _mock.sentence(10),
contentType: 'text',
attachments: [],
createdAt: fSub({ days: 11 })
},
{
id: uuidv4(),
senderId: otherContacts[10].id,
body: _mock.sentence(11),
contentType: 'text',
attachments: [],
createdAt: fSub({ days: 10 })
}
]
}
];
};
const temp_conversations = _conversations();
async function chat() {
for (let i = 0; i < temp_conversations.length; i++) {
await prisma.chatMessage.upsert({
where: { id: i },
update: {},
create: temp_conversations[i]
});
}
console.log('generate blog-postitem done');
}
const Chat = chat()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});
export { Chat };

Some files were not shown because too many files have changed in this diff Show More