Compare commits
61 Commits
7105bc85e3
...
develop/io
Author | SHA1 | Date | |
---|---|---|---|
![]() |
30e4c69343 | ||
![]() |
04634b5c65 | ||
![]() |
f659020d89 | ||
![]() |
184aaa1b0a | ||
![]() |
a6170778cd | ||
![]() |
650127821b | ||
![]() |
5440f8ea14 | ||
![]() |
f4c9dbcc34 | ||
![]() |
f756fb8527 | ||
![]() |
3f10a0728c | ||
![]() |
ee0aa0353b | ||
![]() |
2c7316786c | ||
![]() |
89f91ec2a0 | ||
![]() |
1441863dcd | ||
![]() |
1835caee68 | ||
![]() |
bac8c70d4b | ||
![]() |
975a528b49 | ||
![]() |
749fef7e28 | ||
![]() |
cf34833d42 | ||
![]() |
7bb45316af | ||
![]() |
02771185af | ||
![]() |
cf70e2af21 | ||
![]() |
1a77c3a5e8 | ||
![]() |
af446aed59 | ||
![]() |
c7f1f544ec | ||
![]() |
99ee2f9fc3 | ||
![]() |
a4cdb4b1cc | ||
![]() |
b35b77557e | ||
![]() |
6842459499 | ||
![]() |
ba7682e7cb | ||
![]() |
1003fa699c | ||
![]() |
ec12ca3bdf | ||
![]() |
7ece1c814b | ||
![]() |
39a7d32fcd | ||
![]() |
85d1ecdc90 | ||
![]() |
b26e1ff167 | ||
![]() |
de415a37bc | ||
![]() |
01a8d2ca02 | ||
![]() |
e5b136b8b5 | ||
![]() |
031dbed6a9 | ||
![]() |
f20dfa00c2 | ||
![]() |
24c91cb6f0 | ||
![]() |
abca91c26a | ||
![]() |
3321eafffa | ||
![]() |
adc9275d3f | ||
![]() |
60eed00cb2 | ||
![]() |
c29ab4b920 | ||
![]() |
9d46de56c3 | ||
![]() |
3f9d88e733 | ||
![]() |
6e576919ab | ||
![]() |
9739583f43 | ||
![]() |
bc1ec72df1 | ||
![]() |
e62dc5f597 | ||
![]() |
b5e9c8ba34 | ||
![]() |
9a8fd1c073 | ||
![]() |
25c1d3c917 | ||
![]() |
f435300740 | ||
![]() |
299567dd7c | ||
![]() |
fe1740d76f | ||
![]() |
f840f02daf | ||
![]() |
5640d4d4f6 |
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* text=lf
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -2,8 +2,13 @@
|
|||||||
node_modules
|
node_modules
|
||||||
005_references/
|
005_references/
|
||||||
_archive/
|
_archive/
|
||||||
|
|
||||||
_del
|
_del
|
||||||
*.bak
|
*.bak
|
||||||
*.log
|
*.log
|
||||||
*.del
|
*.del
|
||||||
**/_del
|
**/_del
|
||||||
|
|
||||||
|
**/volumes/**
|
||||||
|
006_lab
|
||||||
|
**/*.draft
|
||||||
|
10
.prettierrc
Normal file
10
.prettierrc
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"printWidth": 120,
|
||||||
|
"quoteProps": "consistent",
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"plugins": []
|
||||||
|
}
|
12
.vscode/extensions.json
vendored
Normal file
12
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"aflalo.dbml-formatter",
|
||||||
|
"bierner.markdown-mermaid",
|
||||||
|
"christian-kohler.path-intellisense",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
|
"humao.rest-client",
|
||||||
|
"matt-meyers.vscode-dbml",
|
||||||
|
"nicolas-liger.dbml-viewer",
|
||||||
|
"yzhang.markdown-all-in-one"
|
||||||
|
]
|
||||||
|
}
|
21
.vscode/settings.json
vendored
Normal file
21
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[javascriptreact]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[jsonc]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[typescriptreact]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"workbench.iconTheme": "material-icon-theme",
|
||||||
|
"workbench.colorTheme": "Default Dark Modern",
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"git.ignoreLimitWarning": true
|
||||||
|
}
|
25
000_AI_WORKSPACE/software-engineer/_examples/001_clone.md
Normal file
25
000_AI_WORKSPACE/software-engineer/_examples/001_clone.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/teachers/view/[id]/page.tsx.draft` to handle `Teacher` record thanks, modify comments/variables/paths/functions name please
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
please review and update all tsx files in folder `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Users` to make it handle `user` record thanks
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- read and understand @/_AI_WORKSPACE/greetings/001_greetings.md -->
|
||||||
|
## clone source code from one type to another
|
||||||
|
|
||||||
|
please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/teacher/_GUIDELINES.md` to handle `Teacher` record thanks,
|
||||||
|
modify comments/variables/paths/functions name please
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
please help to update the tsx files inside folder `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/student` to handle the `student` record
|
||||||
|
|
||||||
|
## steps
|
||||||
|
|
||||||
|
- list all `tsx` files inside directory, remember the list
|
||||||
|
- clone the original `<original>.tsx` files to `<original>.tsx.draft`
|
||||||
|
- do all your modification within `<original>.tsx.draft` files, leave `original.tsx` unchange
|
||||||
|
|
||||||
|
---
|
@@ -0,0 +1,14 @@
|
|||||||
|
```markdown
|
||||||
|
# Greetings
|
||||||
|
|
||||||
|
Hi,
|
||||||
|
|
||||||
|
Imagine you are a software engineer and i will send you the guideline.
|
||||||
|
plesae read it, prepare yourself and i will tell you the task afterwards
|
||||||
|
|
||||||
|
please read and understand the markdown files in directory
|
||||||
|
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/000_AI_WORKSPACE/software-engineer/greetings`,
|
||||||
|
it provides background information of project i want you to help.
|
||||||
|
|
||||||
|
thanks
|
||||||
|
```
|
@@ -0,0 +1,32 @@
|
|||||||
|
# guideline
|
||||||
|
|
||||||
|
## principles
|
||||||
|
|
||||||
|
- at any time, please keep your answer, solution, explaination simple and short (K.I.S.S. or 大道至簡)
|
||||||
|
- please divide the problem into small parts
|
||||||
|
- if you found youself cannot understand the problem, please stop and ask how to do
|
||||||
|
- if you found youself cannot solve the problem, plesae stop and ask how to do
|
||||||
|
- review the whole solution before you reply to user
|
||||||
|
- if code syntax is already there, do follow (e.g. naming convention, syntax) the existing code
|
||||||
|
- no need to explain the reason until you are told to do so
|
||||||
|
- no need to show me the code change, at the end just simple summary in point form is ok
|
||||||
|
|
||||||
|
## highlighted project directories and their meanings
|
||||||
|
|
||||||
|
- `_ignore_this_directory` please ignore this directory and any files inside it
|
||||||
|
|
||||||
|
- `001_documentation` documentation of this project
|
||||||
|
- `002_source` source code of this project
|
||||||
|
- `002_source/cms` home of Context management system of this project
|
||||||
|
- use singular form for `src/components/dashboard` (e.g. `src/components/dashboard/student`)
|
||||||
|
- use plural form for `src/app/dashboard` (e.g. `src/app/dashboard/students`)
|
||||||
|
- `002_source/ionic_mobile` home of mobile client of this project
|
||||||
|
- `002_source/pocketbase` home of pocketbase home directory this project
|
||||||
|
- `003_test` e2e test of this project (not yet implemented)
|
||||||
|
- `004_marketing` marketing page of this project (not yet implemented)
|
||||||
|
- `005_references` opensource refence of this project
|
||||||
|
- `006_lab` my test (POC) of this project
|
||||||
|
- `README.md` Readme of this project
|
||||||
|
- `TODO.md` todo list of this project
|
||||||
|
|
||||||
|
- if the directory contains `_GUIDELINES.md`, please read it before operation
|
22
000_AI_WORKSPACE/software-engineer/greetings/010_FAQ.md
Normal file
22
000_AI_WORKSPACE/software-engineer/greetings/010_FAQ.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# FAQ
|
||||||
|
|
||||||
|
Q: where is `dbml` file ?
|
||||||
|
A: dbml file located in `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema.dbml`
|
||||||
|
|
||||||
|
Q: when file not found, do i need to search it in `_ignore_this_directory` ?
|
||||||
|
A: No, you just stop there and voice out.
|
||||||
|
|
||||||
|
Q: Shall I assume the component is already exist ?
|
||||||
|
A: yes, you can assume that
|
||||||
|
|
||||||
|
Q: Is `COL_USER_METAS` the collection for User related (e.g. `Teacher`, `Student`) collections?
|
||||||
|
A: yes
|
||||||
|
|
||||||
|
Q: Shall I verify `import` or `types` when do modification job ?
|
||||||
|
A: No, you just replace the name of the function, variables etc is ok. no need to check for dependencies thanks.
|
||||||
|
|
||||||
|
Q: how to list files with `.tsx.draft` extensions in `src/db/UserMetas` folder?
|
||||||
|
A: using command like `find src/db/UserMetas -name "*.tsx.draft" -type f -ls` to list the files with `.tsx.draft` extendions only exist in `src/db/UserMetas`
|
||||||
|
|
||||||
|
Q: when user want to modify `.tsx.draft` file, do i need to take care the `.tsx` file as well?
|
||||||
|
A: No, no don't need to, user will handle the remaining modifications. please restrict your modification in the mentioned file or directory only.
|
39
000_AI_WORKSPACE/software-engineer/greetings/013_DB.md
Normal file
39
000_AI_WORKSPACE/software-engineer/greetings/013_DB.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# database and schemas
|
||||||
|
|
||||||
|
## getting started
|
||||||
|
|
||||||
|
Imagine there is a:
|
||||||
|
|
||||||
|
1. developer (provide the modification)
|
||||||
|
2. QA engineer (provide the feedback, and testing)
|
||||||
|
3. software engineer
|
||||||
|
4. technical writer
|
||||||
|
|
||||||
|
they will:
|
||||||
|
|
||||||
|
- conclude and integrate the ideas from developer and QA engineer
|
||||||
|
- make decision to modify the code accordingly.
|
||||||
|
|
||||||
|
## project background and initial setup
|
||||||
|
|
||||||
|
- **IMPORTANT**: No need to reply me what you are going on and your digest in this phase.
|
||||||
|
No need to show me your code plan
|
||||||
|
Just reply me "OK" when done
|
||||||
|
|
||||||
|
- base_dir=`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project`
|
||||||
|
|
||||||
|
- `schema.dbml`
|
||||||
|
- read `<base_dir>/001_documentation/Requirements/REQ0006/schema.dbml`
|
||||||
|
this is file in `dbml` format stating the main database structure
|
||||||
|
|
||||||
|
- `schema.json`
|
||||||
|
- read `<base_dir>/002_source/cms/src/db/schema.json`
|
||||||
|
this is the file of current pocketbase schema
|
||||||
|
|
||||||
|
- look into the md files in folder `<base_dir>/002_source/ionic_mobile/_AI_WORKSPACE/001_guideline`
|
||||||
|
|
||||||
|
- if the directory user provided contins `_GUIDELINES.md`, please read the file
|
||||||
|
|
||||||
|
- read the files, remember and link up the ideas in file stated above, i will tell them the task afterwards
|
||||||
|
|
||||||
|
- please review at least 3 times after you modified the code
|
@@ -2,7 +2,10 @@ please review and update all tsx files in folder `/home/logic/_wsl_workspace/001
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
please modify and update `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/students/edit/[customerId]/page.tsx.draft` to handle `Student` record thanks,
|
<!-- read and understand @/_AI_WORKSPACE/greetings/001_greetings.md -->
|
||||||
|
## clone source code from one type to another
|
||||||
|
|
||||||
|
please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/teacher/_GUIDELINES.md` to handle `Teacher` record thanks,
|
||||||
modify comments/variables/paths/functions name please
|
modify comments/variables/paths/functions name please
|
||||||
|
|
||||||
---
|
---
|
@@ -0,0 +1,33 @@
|
|||||||
|
Hi, i need your help.
|
||||||
|
|
||||||
|
## task
|
||||||
|
|
||||||
|
i am working on a `dbml` file
|
||||||
|
i got a `schema.json` which is exported from pocketbase
|
||||||
|
and i want to update it to my current `dbml` file (one way process for documentation usage)
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
- the collection from `json` file started with `_` can be ignored. they are system collection and should not appear in `dbml`
|
||||||
|
- one collection from `json` file mapped with one table in `dbml` file
|
||||||
|
- the `presentable` field from `json` file should be ignored.
|
||||||
|
- the `id` of collection in `json` file should be jod down in the comment of `dbml` file as an reference.
|
||||||
|
- you can find the comments in `schema.dbml` contains `pb_xxx` and that is the reference to the table in `schema.json` file.
|
||||||
|
|
||||||
|
## steps
|
||||||
|
|
||||||
|
- list the collection
|
||||||
|
|
||||||
|
## information
|
||||||
|
|
||||||
|
json file: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema.json`
|
||||||
|
dbml file: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema.dbml`
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
1. 对于json中有但dbml中没有的表,应该如何处理? 添加为新表
|
||||||
|
1. 是否需要保留dbml文件中现有的注释和关系定义? 完全保留
|
||||||
|
1. 字段类型映射是否有特殊规则? 沒有
|
||||||
|
1. please keep the existing comment
|
||||||
|
|
||||||
|
thanks
|
@@ -2,7 +2,7 @@ Hi, i will send you the guideline,
|
|||||||
plesae read it, prepare yourself and i will tell you the task afterwards
|
plesae read it, prepare yourself and i will tell you the task afterwards
|
||||||
|
|
||||||
please read and understand the markdown files in directory
|
please read and understand the markdown files in directory
|
||||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/_AI_WORKSPACE/greetings`,
|
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/000_AI_WORKSPACE/_AI_WORKSPACE/greetings`,
|
||||||
it provides background information of project i want you to help.
|
it provides background information of project i want you to help.
|
||||||
|
|
||||||
thanks
|
thanks
|
@@ -18,7 +18,7 @@
|
|||||||
- `001_documentation` documentation of this project
|
- `001_documentation` documentation of this project
|
||||||
- `002_source` source code of this project
|
- `002_source` source code of this project
|
||||||
- `002_source/cms` home of Context management system of this project
|
- `002_source/cms` home of Context management system of this project
|
||||||
- `002_source/ionic` home of mobile client of this project
|
- `002_source/ionic_mobile` home of mobile client of this project
|
||||||
- `002_source/pocketbase` home of pocketbase home directory this project
|
- `002_source/pocketbase` home of pocketbase home directory this project
|
||||||
- `003_test` e2e test of this project (not yet implemented)
|
- `003_test` e2e test of this project (not yet implemented)
|
||||||
- `004_marketing` marketing page of this project (not yet implemented)
|
- `004_marketing` marketing page of this project (not yet implemented)
|
@@ -0,0 +1,12 @@
|
|||||||
|
# Knowledgebase
|
||||||
|
|
||||||
|
you can answer the question with below knowledge:
|
||||||
|
|
||||||
|
## frameworks and stacks
|
||||||
|
|
||||||
|
- if code syntax is already there, do follow (e.g. naming convention, syntax) the existing code
|
||||||
|
- make use of MCP `Context7` when you troubleshoot the problem with below topics:
|
||||||
|
- [pocketbase javascript SDK](https://context7.com/pocketbase/js-sdk/llms.txt)
|
||||||
|
- [DBML](https://context7.com/holistics/dbml/llms.txt)
|
||||||
|
- [ionic framework](https://context7.com/ionic-team/ionic-framework/llms.txt)
|
||||||
|
- [nextjs 14 app router](https://context7.com/nextjsargentina/next.js-docs/llms.txt)
|
@@ -1,4 +1,4 @@
|
|||||||
# AI GUIDELINE
|
# database and schemas
|
||||||
|
|
||||||
## getting started
|
## getting started
|
||||||
|
|
2
001_documentation/.vscode/extensions.json
vendored
2
001_documentation/.vscode/extensions.json
vendored
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"redhat.vscode-yaml",
|
|
||||||
"yzhang.markdown-all-in-one",
|
"yzhang.markdown-all-in-one",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"ms-python.python",
|
"ms-python.python",
|
||||||
@@ -8,7 +7,6 @@
|
|||||||
"ms-python.debugpy",
|
"ms-python.debugpy",
|
||||||
"ms-python.black-formatter",
|
"ms-python.black-formatter",
|
||||||
"ms-python.isort",
|
"ms-python.isort",
|
||||||
"ms-python.pylint",
|
|
||||||
"bierner.markdown-mermaid",
|
"bierner.markdown-mermaid",
|
||||||
"shd101wyy.markdown-preview-enhanced",
|
"shd101wyy.markdown-preview-enhanced",
|
||||||
"yzhang.markdown-all-in-one",
|
"yzhang.markdown-all-in-one",
|
||||||
|
@@ -24,5 +24,4 @@ mindmap
|
|||||||
Tools
|
Tools
|
||||||
Pen and paper
|
Pen and paper
|
||||||
Mermaid
|
Mermaid
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@@ -1,9 +1,27 @@
|
|||||||
---
|
---
|
||||||
tags: mobile, lesson
|
tags: time
|
||||||
---
|
---
|
||||||
|
|
||||||
# lesson page documentation
|
# time tracking
|
||||||
|
|
||||||
it should have a lesson page
|
T.B.A.
|
||||||
|
|
||||||

|
```mermaid
|
||||||
|
gantt
|
||||||
|
title A Gantt Diagram
|
||||||
|
dateFormat YYYY-MM-DD
|
||||||
|
section Section
|
||||||
|
A task :a1, 2014-01-01, 30d
|
||||||
|
Another task :after a1, 20d
|
||||||
|
section Another
|
||||||
|
Task in Another :2014-01-12, 12d
|
||||||
|
another task :24d
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## TODOs of the project
|
||||||
|
|
||||||
|
- [cms TODO](../../../002_source/cms/TODO.md)
|
||||||
|
- [ionic TODO](../../../002_source/ionic_mobile/TODO.md)
|
||||||
|
- [pocketbase TODO](../../../002_source/pocketbase/TODO.md)
|
||||||
|
@@ -0,0 +1,20 @@
|
|||||||
|
# task
|
||||||
|
|
||||||
|
update `dbml` from `schema.json`, for collection `billingAddress`
|
||||||
|
|
||||||
|
## Background information
|
||||||
|
|
||||||
|
1. please ignore `presentable` properties from `schema.json`, this is for pocketbase internal usage
|
||||||
|
1. please ignore collections with `_` as its first character, this is for pocketbase internal usage
|
||||||
|
1. just return the collection with `billingAddress` is ok, please ignore other collections
|
||||||
|
|
||||||
|
## steps
|
||||||
|
|
||||||
|
1. read file `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/schema.json`. this is the export from `pocketbase`.
|
||||||
|
1. read file `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema.dbml`. this is file written in dbml format.
|
||||||
|
1. currently the collection in `schama.json` is mapped to table in `schema.dbml`
|
||||||
|
1. compare the `schema.json` and `schema.dbml`, remember the differences
|
||||||
|
1. you may found some comment already exist in `schema.dbml`, please keep them
|
||||||
|
1. while keeping `schema.json` content unchanged. write file to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema_ai_draft.dbml` content based on `schema.json`.
|
||||||
|
|
||||||
|
thanks.
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# LessonCategories / LessonCategory
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listLessonCategories.ts to cover `LessonCategories`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistLessonCategories,`
|
|
||||||
- `getListByFilterLessonCategories,`
|
|
||||||
- `getFirstListItemLessonCategories,`
|
|
||||||
- `getOneLessonCategory,`
|
|
||||||
- `getListLessonCategoryById`
|
|
||||||
|
|
||||||
thanks
|
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# LessonTypes / LessonType
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listLessonTypes.ts to cover `LessonTypes`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistLessonTypes,`
|
|
||||||
- `getListByFilterLessonTypes,`
|
|
||||||
- `getFirstListItemLessonTypes,`
|
|
||||||
- `getOneLessonType,`
|
|
||||||
- `getListLessonTypeById`
|
|
||||||
|
|
||||||
thanks
|
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# QuizCategories / QuizCategory
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listQuizCategories.ts to cover `QuizCategories`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistQuizCategories,`
|
|
||||||
- `getListByFilterQuizCategories,`
|
|
||||||
- `getFirstListItemQuizCategories,`
|
|
||||||
- `getOneQuizCategory,`
|
|
||||||
- `getListQuizCategoryById`
|
|
||||||
|
|
||||||
thanks
|
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# QuizConnectives / QuizConnective
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listQuizConnectives.ts to cover `QuizConnectives`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistQuizConnectives,`
|
|
||||||
- `getListByFilterQuizConnectives,`
|
|
||||||
- `getFirstListItemQuizConnectives,`
|
|
||||||
- `getOneQuizConnective,`
|
|
||||||
- `getListQuizConnectiveById`
|
|
||||||
|
|
||||||
thanks
|
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# QuizConnectivesCategories / QuizConnectivesCategory
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listQuizConnectivesCategories.ts to cover `QuizConnectivesCategories`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistQuizConnectivesCategories,`
|
|
||||||
- `getListByFilterQuizConnectivesCategories,`
|
|
||||||
- `getFirstListItemQuizConnectivesCategories,`
|
|
||||||
- `getOneQuizConnectivesCategory,`
|
|
||||||
- `getListQuizConnectivesCategoryById`
|
|
||||||
|
|
||||||
thanks
|
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# QuizListenings / QuizListening
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listQuizListenings.ts to cover `QuizListenings`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistQuizListenings,`
|
|
||||||
- `getListByFilterQuizListenings,`
|
|
||||||
- `getFirstListItemQuizListenings,`
|
|
||||||
- `getOneQuizListening,`
|
|
||||||
- `getListQuizListeningById`
|
|
||||||
|
|
||||||
thanks
|
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# QuizMatchings / QuizMatching
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listQuizMatchings.ts to cover `QuizMatchings`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistQuizMatchings,`
|
|
||||||
- `getListByFilterQuizMatchings,`
|
|
||||||
- `getFirstListItemQuizMatchings,`
|
|
||||||
- `getOneQuizMatching,`
|
|
||||||
- `getListQuizMatchingById`
|
|
||||||
|
|
||||||
thanks
|
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# UserMetas / UserMeta
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listUserMetas.ts to cover `UserMetas`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistUserMetas,`
|
|
||||||
- `getListByFilterUserMetas,`
|
|
||||||
- `getFirstListItemUserMetas,`
|
|
||||||
- `getOneUserMeta,`
|
|
||||||
- `getListUserMetaById`
|
|
||||||
|
|
||||||
thanks
|
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# Users / User
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listUsers.ts to cover `Users`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistUsers,`
|
|
||||||
- `getListByFilterUsers,`
|
|
||||||
- `getFirstListItemUsers,`
|
|
||||||
- `getOneUser,`
|
|
||||||
- `getListUserById`
|
|
||||||
|
|
||||||
thanks
|
|
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# Vocabularies / Vocabulary
|
|
||||||
|
|
||||||
Hi, using information from
|
|
||||||
|
|
||||||
- @schema.dbml for schemas, fields and table names,
|
|
||||||
- @listHelloworld.ts for skeleton for ts script
|
|
||||||
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference
|
|
||||||
|
|
||||||
extend @listVocabularies.ts to cover `Vocabularies`,
|
|
||||||
draft `ts` code
|
|
||||||
|
|
||||||
- `CRUD`
|
|
||||||
- `getFulllistVocabularies,`
|
|
||||||
- `getListByFilterVocabularies,`
|
|
||||||
- `getFirstListItemVocabularies,`
|
|
||||||
- `getOneVocabulary,`
|
|
||||||
- `getListVocabularyById`
|
|
||||||
|
|
||||||
thanks
|
|
6
001_documentation/Requirements/REQ0006/_GUIDELINE.md
Normal file
6
001_documentation/Requirements/REQ0006/_GUIDELINE.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# GUIDELINES
|
||||||
|
|
||||||
|
- `schema.dbml` means DB schema in `dbml` format
|
||||||
|
- `schema.json` contains the exported DB schema from pocketbase
|
||||||
|
- the `Collection ID: xxx` in `dbml` file contains the collection `id` mapping from `schema.json`
|
||||||
|
- the `presentable` field from `json` file should be ignored.
|
86
001_documentation/Requirements/REQ0006/convert.js
Normal file
86
001_documentation/Requirements/REQ0006/convert.js
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
//
|
||||||
|
// # REQ0015:
|
||||||
|
// ## PURPOSE:
|
||||||
|
//
|
||||||
|
// This is a script to convert `schema.json` exported from pocketbase to dbml formatted file `schema.dbml`
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
// Load schema.json
|
||||||
|
const schemaPath = path.join(process.cwd(), "schema.json");
|
||||||
|
const schema = JSON.parse(fs.readFileSync(schemaPath, "utf8"));
|
||||||
|
|
||||||
|
// Type mapping from PocketBase to DBML/SQL
|
||||||
|
const typeMapping = {
|
||||||
|
text: "text",
|
||||||
|
number: "integer",
|
||||||
|
bool: "boolean",
|
||||||
|
email: "text",
|
||||||
|
url: "varchar",
|
||||||
|
date: "datetime",
|
||||||
|
select: "varchar",
|
||||||
|
json: "text",
|
||||||
|
file: "file",
|
||||||
|
password: "varchar",
|
||||||
|
relation: "integer", // Assuming relations are stored as integer IDs
|
||||||
|
autodate: "datetime",
|
||||||
|
};
|
||||||
|
|
||||||
|
function convertToDBML(schema) {
|
||||||
|
let dbml = "";
|
||||||
|
dbml = "// Generated at: " + new Date().toISOString();
|
||||||
|
dbml = dbml + "\n\n\n";
|
||||||
|
|
||||||
|
let collectionIdToTableMapping = {};
|
||||||
|
for (const [idx, tableDef] of Object.entries(schema)) {
|
||||||
|
collectionIdToTableMapping[tableDef.id] = tableDef.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const [idx, tableDef] of Object.entries(schema)) {
|
||||||
|
console.log({ idx });
|
||||||
|
dbml += `// \n`;
|
||||||
|
dbml += `// collection id: ${tableDef.id} \n`;
|
||||||
|
dbml += `// collection name: ${tableDef.name} \n`;
|
||||||
|
dbml += `// collection type: ${tableDef.type} \n`;
|
||||||
|
dbml += `Table ${tableDef.name} {\n`;
|
||||||
|
|
||||||
|
for (const field of tableDef.fields) {
|
||||||
|
// Get field type
|
||||||
|
let fieldType = typeMapping[field.type] || "text";
|
||||||
|
|
||||||
|
// Handle special cases
|
||||||
|
if (field.type === "number" && field.options?.max === 1) {
|
||||||
|
fieldType = "boolean";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build field definition
|
||||||
|
let line = ` ${field.name} ${fieldType}`;
|
||||||
|
|
||||||
|
// Add constraints
|
||||||
|
const constraints = [];
|
||||||
|
if (field.name === "id" || field.primary) constraints.push("pk");
|
||||||
|
if (field.required) constraints.push("not null");
|
||||||
|
if (constraints.length > 0) line += ` [${constraints.join(", ")}]`;
|
||||||
|
|
||||||
|
if (field.collectionId) {
|
||||||
|
line += ` [ref: > ${
|
||||||
|
collectionIdToTableMapping[field.collectionId]
|
||||||
|
}.id] // ${field.id}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbml += `${line}\n`;
|
||||||
|
console.log({ line });
|
||||||
|
}
|
||||||
|
|
||||||
|
dbml += "}\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return dbml;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert and save
|
||||||
|
const dbmlOutput = convertToDBML(schema);
|
||||||
|
fs.writeFileSync("schema.dbml", dbmlOutput);
|
||||||
|
console.log("DBML file generated successfully!");
|
@@ -0,0 +1,31 @@
|
|||||||
|
import { faker } from "@faker-js/faker";
|
||||||
|
|
||||||
|
const getId = (id) => id.padStart(15, "0");
|
||||||
|
|
||||||
|
const row_array = Array.from({ length: 10 }, (_, i) => [
|
||||||
|
getId(String(i + 1)),
|
||||||
|
faker.person.firstName(),
|
||||||
|
"",
|
||||||
|
faker.internet.email(),
|
||||||
|
faker.phone.number(),
|
||||||
|
faker.company.name(),
|
||||||
|
{
|
||||||
|
country: faker.location.country(),
|
||||||
|
state: faker.location.state(),
|
||||||
|
city: faker.location.city(),
|
||||||
|
zipCode: faker.location.zipCode(),
|
||||||
|
line1: faker.location.streetAddress(),
|
||||||
|
line2: faker.location.secondaryAddress(),
|
||||||
|
},
|
||||||
|
Math.floor(Math.random() * (100 - 0 + 1)) + 0,
|
||||||
|
faker.location.timeZone(),
|
||||||
|
["en", "de", "es", "fr", "ja", "ko", "zh-CN"].sort(
|
||||||
|
() => Math.random() - 0.5
|
||||||
|
)[0],
|
||||||
|
faker.finance.currencyCode(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
import fs from "fs";
|
||||||
|
const filePath = "output.json";
|
||||||
|
fs.writeFileSync(filePath, JSON.stringify(row_array, null, 2));
|
||||||
|
console.log(`Wrote ${row_array.length} records to ${filePath}`);
|
202
001_documentation/Requirements/REQ0006/gen_customer/output.json
Normal file
202
001_documentation/Requirements/REQ0006/gen_customer/output.json
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
[
|
||||||
|
[
|
||||||
|
"000000000000001",
|
||||||
|
"May",
|
||||||
|
"",
|
||||||
|
"June_Wintheiser33@hotmail.com",
|
||||||
|
"281-378-5900 x822",
|
||||||
|
"Green, Rempel and Hoeger",
|
||||||
|
{
|
||||||
|
"country": "Central African Republic",
|
||||||
|
"state": "Arizona",
|
||||||
|
"city": "Winfieldburgh",
|
||||||
|
"zipCode": "92017-8004",
|
||||||
|
"line1": "1838 Willa Freeway",
|
||||||
|
"line2": "Suite 307"
|
||||||
|
},
|
||||||
|
98,
|
||||||
|
"Asia/Urumqi",
|
||||||
|
"de",
|
||||||
|
"MUR"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"000000000000002",
|
||||||
|
"Marilyne",
|
||||||
|
"",
|
||||||
|
"Carol_Blick@yahoo.com",
|
||||||
|
"(893) 919-2445 x193",
|
||||||
|
"White - Hessel",
|
||||||
|
{
|
||||||
|
"country": "Iraq",
|
||||||
|
"state": "Nevada",
|
||||||
|
"city": "Casa Grande",
|
||||||
|
"zipCode": "83831-3843",
|
||||||
|
"line1": "6984 Alberto Radial",
|
||||||
|
"line2": "Suite 154"
|
||||||
|
},
|
||||||
|
49,
|
||||||
|
"Africa/Tunis",
|
||||||
|
"zh-CN",
|
||||||
|
"CHF"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"000000000000003",
|
||||||
|
"Jacklyn",
|
||||||
|
"",
|
||||||
|
"Tamara_Lynch11@yahoo.com",
|
||||||
|
"597-593-0144 x168",
|
||||||
|
"Rolfson LLC",
|
||||||
|
{
|
||||||
|
"country": "Grenada",
|
||||||
|
"state": "Georgia",
|
||||||
|
"city": "New Brodyfort",
|
||||||
|
"zipCode": "18887-7075",
|
||||||
|
"line1": "493 Pfannerstill Meadow",
|
||||||
|
"line2": "Apt. 358"
|
||||||
|
},
|
||||||
|
44,
|
||||||
|
"Asia/Manila",
|
||||||
|
"zh-CN",
|
||||||
|
"CDF"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"000000000000004",
|
||||||
|
"Alana",
|
||||||
|
"",
|
||||||
|
"Ahmed_Willms@hotmail.com",
|
||||||
|
"401.212.0386 x31125",
|
||||||
|
"Friesen, Langworth and Thompson",
|
||||||
|
{
|
||||||
|
"country": "Australia",
|
||||||
|
"state": "North Carolina",
|
||||||
|
"city": "Fort Jerrell",
|
||||||
|
"zipCode": "14211",
|
||||||
|
"line1": "1763 West Street",
|
||||||
|
"line2": "Suite 699"
|
||||||
|
},
|
||||||
|
34,
|
||||||
|
"America/Boa_Vista",
|
||||||
|
"ja",
|
||||||
|
"KES"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"000000000000005",
|
||||||
|
"Rocky",
|
||||||
|
"",
|
||||||
|
"Angela_Kuhic@gmail.com",
|
||||||
|
"653.964.0412",
|
||||||
|
"Hayes - Morar",
|
||||||
|
{
|
||||||
|
"country": "Reunion",
|
||||||
|
"state": "New York",
|
||||||
|
"city": "Kayton",
|
||||||
|
"zipCode": "82048-0645",
|
||||||
|
"line1": "636 Angel Junction",
|
||||||
|
"line2": "Apt. 361"
|
||||||
|
},
|
||||||
|
70,
|
||||||
|
"America/Grand_Turk",
|
||||||
|
"fr",
|
||||||
|
"PGK"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"000000000000006",
|
||||||
|
"Carmela",
|
||||||
|
"",
|
||||||
|
"Larry94@hotmail.com",
|
||||||
|
"1-508-980-1889 x134",
|
||||||
|
"Goodwin - Brown",
|
||||||
|
{
|
||||||
|
"country": "Heard Island and McDonald Islands",
|
||||||
|
"state": "Wisconsin",
|
||||||
|
"city": "Jalenbury",
|
||||||
|
"zipCode": "75732-7013",
|
||||||
|
"line1": "669 Sven Trail",
|
||||||
|
"line2": "Suite 409"
|
||||||
|
},
|
||||||
|
48,
|
||||||
|
"Asia/Karachi",
|
||||||
|
"fr",
|
||||||
|
"AMD"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"000000000000007",
|
||||||
|
"Lucious",
|
||||||
|
"",
|
||||||
|
"Lera67@yahoo.com",
|
||||||
|
"(684) 748-3653 x8745",
|
||||||
|
"Harvey - Kilback",
|
||||||
|
{
|
||||||
|
"country": "Israel",
|
||||||
|
"state": "Maryland",
|
||||||
|
"city": "East Allenmouth",
|
||||||
|
"zipCode": "21779",
|
||||||
|
"line1": "6070 W Grand Avenue",
|
||||||
|
"line2": "Suite 448"
|
||||||
|
},
|
||||||
|
83,
|
||||||
|
"America/St_Barthelemy",
|
||||||
|
"en",
|
||||||
|
"SBD"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"000000000000008",
|
||||||
|
"Anika",
|
||||||
|
"",
|
||||||
|
"Shane.Moore@gmail.com",
|
||||||
|
"(996) 909-3575 x614",
|
||||||
|
"Donnelly, Larson and Stamm",
|
||||||
|
{
|
||||||
|
"country": "Canada",
|
||||||
|
"state": "Michigan",
|
||||||
|
"city": "Lafayette",
|
||||||
|
"zipCode": "90430-8775",
|
||||||
|
"line1": "430 Orland Place",
|
||||||
|
"line2": "Suite 891"
|
||||||
|
},
|
||||||
|
64,
|
||||||
|
"America/Toronto",
|
||||||
|
"fr",
|
||||||
|
"PKR"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"000000000000009",
|
||||||
|
"Otto",
|
||||||
|
"",
|
||||||
|
"Emery_Wisozk@yahoo.com",
|
||||||
|
"1-602-251-7035 x9461",
|
||||||
|
"Kreiger - Boehm",
|
||||||
|
{
|
||||||
|
"country": "South Georgia and the South Sandwich Islands",
|
||||||
|
"state": "Colorado",
|
||||||
|
"city": "Lake Isaias",
|
||||||
|
"zipCode": "26025-5909",
|
||||||
|
"line1": "143 Kautzer Unions",
|
||||||
|
"line2": "Apt. 752"
|
||||||
|
},
|
||||||
|
98,
|
||||||
|
"Africa/Ndjamena",
|
||||||
|
"fr",
|
||||||
|
"JOD"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"000000000000010",
|
||||||
|
"Cortez",
|
||||||
|
"",
|
||||||
|
"Jameson13@hotmail.com",
|
||||||
|
"1-660-472-1494",
|
||||||
|
"Parisian LLC",
|
||||||
|
{
|
||||||
|
"country": "Mali",
|
||||||
|
"state": "Illinois",
|
||||||
|
"city": "Stammburgh",
|
||||||
|
"zipCode": "92318",
|
||||||
|
"line1": "7669 Jude Drive",
|
||||||
|
"line2": "Apt. 594"
|
||||||
|
},
|
||||||
|
59,
|
||||||
|
"Africa/Lubumbashi",
|
||||||
|
"en",
|
||||||
|
"VND"
|
||||||
|
]
|
||||||
|
]
|
33
001_documentation/Requirements/REQ0006/gen_customer/package-lock.json
generated
Normal file
33
001_documentation/Requirements/REQ0006/gen_customer/package-lock.json
generated
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "gen_customer",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "gen_customer",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"@faker-js/faker": "^9.7.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@faker-js/faker": {
|
||||||
|
"version": "9.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-9.7.0.tgz",
|
||||||
|
"integrity": "sha512-aozo5vqjCmDoXLNUJarFZx2IN/GgGaogY4TMJ6so/WLZOWpSV7fvj2dmrV6sEAnUm1O7aCrhTibjpzeDFgNqbg==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/fakerjs"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0",
|
||||||
|
"npm": ">=9.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "gen_customer",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "gen_customer.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"description": "",
|
||||||
|
"devDependencies": {
|
||||||
|
"@faker-js/faker": "^9.7.0"
|
||||||
|
}
|
||||||
|
}
|
23
001_documentation/Requirements/REQ0006/gen_customer/pnpm-lock.yaml
generated
Normal file
23
001_documentation/Requirements/REQ0006/gen_customer/pnpm-lock.yaml
generated
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
lockfileVersion: '9.0'
|
||||||
|
|
||||||
|
settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
devDependencies:
|
||||||
|
'@faker-js/faker':
|
||||||
|
specifier: ^9.7.0
|
||||||
|
version: 9.7.0
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
'@faker-js/faker@9.7.0':
|
||||||
|
resolution: {integrity: sha512-aozo5vqjCmDoXLNUJarFZx2IN/GgGaogY4TMJ6so/WLZOWpSV7fvj2dmrV6sEAnUm1O7aCrhTibjpzeDFgNqbg==}
|
||||||
|
engines: {node: '>=18.0.0', npm: '>=9.0.0'}
|
||||||
|
|
||||||
|
snapshots:
|
||||||
|
|
||||||
|
'@faker-js/faker@9.7.0': {}
|
@@ -1,266 +1,470 @@
|
|||||||
// Users table with auth fields
|
// Generated at: 2025-05-12T06:02:53.613Z
|
||||||
Table Users {
|
|
||||||
// system field
|
|
||||||
id text [pk]
|
|
||||||
tokenKey text [not null]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
password text [not null]
|
|
||||||
|
|
||||||
// value field
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_3142635823
|
||||||
|
// collection name: _superusers
|
||||||
|
// collection type: auth
|
||||||
|
Table _superusers {
|
||||||
|
id text [pk, not null]
|
||||||
|
password varchar [not null]
|
||||||
|
tokenKey text [not null]
|
||||||
|
email text [not null]
|
||||||
|
emailVisibility boolean
|
||||||
|
verified boolean
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: _pb_users_auth_
|
||||||
|
// collection name: users
|
||||||
|
// collection type: auth
|
||||||
|
Table users {
|
||||||
|
id text [pk, not null]
|
||||||
|
password varchar [not null]
|
||||||
|
tokenKey text [not null]
|
||||||
email text [not null]
|
email text [not null]
|
||||||
emailVisibility boolean
|
emailVisibility boolean
|
||||||
verified boolean
|
verified boolean
|
||||||
name text
|
name text
|
||||||
avatar file
|
avatar file
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
visible text
|
||||||
|
phone text
|
||||||
}
|
}
|
||||||
|
|
||||||
// LessonTypes stores different types of lessons
|
//
|
||||||
// lesson_types, lesson_type
|
// collection id: pbc_1430376151
|
||||||
Table LessonTypes {
|
// collection name: Categories
|
||||||
// system field
|
// collection type: base
|
||||||
id text [pk] // changed from int to text
|
Table Categories {
|
||||||
created datetime [default: `now()`] // timestamp when the lesson type was created
|
id text [pk, not null]
|
||||||
updated datetime // timestamp when the lesson type was last updated
|
cat_name text
|
||||||
// value field
|
cat_image_url text
|
||||||
name text // changed from varchar to text
|
cat_image file
|
||||||
type text // changed from varchar to text
|
pos integer
|
||||||
|
lesson_id integer [ref: > LessonsTypes.id] // relation3455582614
|
||||||
|
remarks text
|
||||||
|
visible text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_108570809
|
||||||
|
// collection name: Customers
|
||||||
|
// collection type: base
|
||||||
|
Table Customers {
|
||||||
|
id text [pk, not null]
|
||||||
|
name text
|
||||||
|
email text
|
||||||
|
phone text
|
||||||
|
quota integer
|
||||||
|
status text
|
||||||
|
avatar_file file
|
||||||
|
user_id integer [ref: > users.id] // relation2809058197
|
||||||
|
billingAddress text
|
||||||
|
timezone text
|
||||||
|
language text
|
||||||
|
currency text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_1196309394
|
||||||
|
// collection name: LessonsCategories
|
||||||
|
// collection type: base
|
||||||
|
Table LessonsCategories {
|
||||||
|
id text [pk, not null]
|
||||||
|
cat_name text
|
||||||
|
cat_image_url text
|
||||||
|
cat_image file
|
||||||
|
pos integer
|
||||||
|
lesson_id integer [ref: > LessonsTypes.id] // relation3455582614
|
||||||
|
description text
|
||||||
|
remarks text
|
||||||
|
visible text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_2328411368
|
||||||
|
// collection name: LessonsTypes
|
||||||
|
// collection type: base
|
||||||
|
Table LessonsTypes {
|
||||||
|
id text [pk, not null]
|
||||||
|
name text
|
||||||
|
type text
|
||||||
pos integer
|
pos integer
|
||||||
visible text
|
visible text
|
||||||
field date
|
created datetime
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// LessonCategories stores categories of lessons
|
|
||||||
// lesson_categories, lesson_category
|
|
||||||
Table LessonCategories {
|
|
||||||
// system field
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`] // timestamp when the category was created
|
|
||||||
updated datetime // timestamp when the category was last updated
|
|
||||||
// value field
|
|
||||||
cat_name text // changed from varchar to text
|
|
||||||
cat_image_url text // new field
|
|
||||||
cat_image file // changed from varchar to file
|
|
||||||
pos integer
|
|
||||||
lesson_id integer [ref: > LessonTypes.id] // foreign key referencing LessonTypes.id
|
|
||||||
description text // new field
|
|
||||||
remarks text // changed from varchar to text
|
|
||||||
visible text // new field
|
|
||||||
}
|
|
||||||
|
|
||||||
Table Helloworlds {
|
|
||||||
// system field
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`] // record create time
|
|
||||||
updated datetime // record update time
|
|
||||||
hello text // new field
|
|
||||||
}
|
|
||||||
|
|
||||||
Table UserMetas {
|
|
||||||
// system field
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
updated datetime
|
||||||
|
field datetime
|
||||||
// value field
|
|
||||||
helloworld text // changed from varchar to text
|
|
||||||
meta json // new field
|
|
||||||
user_id text [ref: > Users.id] // changed type and reference
|
|
||||||
state text // new field
|
|
||||||
avatar file // changed from blob to file
|
|
||||||
role text // new field
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Table QuizCategories {
|
//
|
||||||
// system field
|
// collection id: pbc_977978967
|
||||||
id text [pk] // changed from int to text
|
// collection name: Notifications
|
||||||
created datetime [default: `now()`]
|
// collection type: base
|
||||||
|
Table Notifications {
|
||||||
|
id text [pk, not null]
|
||||||
|
read boolean
|
||||||
|
type text
|
||||||
|
job text
|
||||||
|
description text
|
||||||
|
NOTI_ID text
|
||||||
|
created datetime
|
||||||
updated datetime
|
updated datetime
|
||||||
|
to_user_id integer [ref: > UserMetas.id] // relation704048736
|
||||||
// value field
|
from_user_id integer [ref: > UserMetas.id] // relation556806202
|
||||||
cat_name text // changed from varchar to text
|
author integer [ref: > UserMetas.id] // relation3182418120
|
||||||
cat_image text // changed from varchar to text
|
content text
|
||||||
init_answer json // new field
|
company text
|
||||||
|
link varchar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// stores all questions of matching frenzy
|
// collection id: pbc_4061499106
|
||||||
Table QuizMatchings {
|
// collection name: QuizCRCategories
|
||||||
// system field
|
// collection type: base
|
||||||
id text [pk] // changed from int to text
|
Table QuizCRCategories {
|
||||||
created datetime [default: `now()`] // record create time
|
id text [pk, not null]
|
||||||
updated datetime // record update time
|
|
||||||
|
|
||||||
// value field
|
|
||||||
word text // changed from varchar to text
|
|
||||||
word_c text // changed from varchar to text
|
|
||||||
cat_id text [ref: > QuizCategories.id] // changed type and reference
|
|
||||||
}
|
|
||||||
|
|
||||||
// QuizListening stores all listening quiz data
|
|
||||||
Table QuizListenings {
|
|
||||||
// system field
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`] // record create time
|
|
||||||
updated datetime // record update time
|
|
||||||
|
|
||||||
// value field
|
|
||||||
sound file // changed from varchar to file
|
|
||||||
word text // changed from varchar to text
|
|
||||||
cat_id text [ref: > QuizCategories.id] // changed type and reference
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// stores all categories of connectives revision quiz
|
|
||||||
Table QuizConnectivesCategories {
|
|
||||||
// system field
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`] // record create time
|
|
||||||
updated datetime // record update time
|
|
||||||
|
|
||||||
// value field
|
|
||||||
cat_name text // changed from varchar to text
|
|
||||||
cat_image file // changed from varchar to file
|
|
||||||
}
|
|
||||||
|
|
||||||
// stores all questions of connectives revision quiz
|
|
||||||
Table QuizConnectives {
|
|
||||||
// system field
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`] // record create time
|
|
||||||
updated datetime // record update time
|
|
||||||
|
|
||||||
// value field
|
|
||||||
question_fh text // changed from varchar to text
|
|
||||||
question_sh text // changed from varchar to text
|
|
||||||
modal_ans text // changed from varchar to text
|
|
||||||
cat_id text [ref: > QuizConnectivesCategories.id] // changed type and reference
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lessons stores all lessons in the database
|
|
||||||
Table Vocabularies {
|
|
||||||
// system field
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`] // timestamp when the lesson was created
|
|
||||||
updated datetime // timestamp when the lesson was last updated
|
|
||||||
|
|
||||||
// value field
|
|
||||||
image file // changed from varchar to file
|
|
||||||
sound file // changed from varchar to file
|
|
||||||
word text // changed from varchar to text
|
|
||||||
word_c text // changed from varchar to text
|
|
||||||
sample_e text // changed from varchar to text
|
|
||||||
sample_c text // changed from varchar to text
|
|
||||||
cat_id text [ref: > LessonCategories.id] // changed type and reference
|
|
||||||
category text // changed from varchar to text
|
|
||||||
lesson_type_id text [ref: > LessonTypes.id] // changed type and reference
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listening Practice Quiz Categories
|
|
||||||
// store listening practice category, (LpCategories, LpCategory)
|
|
||||||
Table QuizLPCategories {
|
|
||||||
// system fields
|
|
||||||
id text [pk]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
|
|
||||||
// value fields
|
|
||||||
cat_name text
|
cat_name text
|
||||||
cat_image file
|
cat_image file
|
||||||
pos number
|
pos integer
|
||||||
init_answer json
|
init_answer text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_3141885671
|
||||||
|
// collection name: QuizCRQuestions
|
||||||
|
// collection type: base
|
||||||
|
Table QuizCRQuestions {
|
||||||
|
id text [pk, not null]
|
||||||
|
question_fh text
|
||||||
|
question_sh text
|
||||||
|
modal_ans text
|
||||||
|
cat_id integer [ref: > QuizCRCategories.id] // relation1827623476
|
||||||
|
options text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
init_answer text
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_3571292172
|
||||||
|
// collection name: QuizCategories
|
||||||
|
// collection type: base
|
||||||
|
Table QuizCategories {
|
||||||
|
id text [pk, not null]
|
||||||
|
cat_name text
|
||||||
|
cat_image text
|
||||||
|
init_answer text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_96745150
|
||||||
|
// collection name: QuizConnectives
|
||||||
|
// collection type: base
|
||||||
|
Table QuizConnectives {
|
||||||
|
id text [pk, not null]
|
||||||
|
question_fh text
|
||||||
|
question_sh text
|
||||||
|
modal_ans text
|
||||||
|
cat_id integer [ref: > QuizConnectivesCategories.id] // relation3870140739
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_342761728
|
||||||
|
// collection name: QuizConnectivesCategories
|
||||||
|
// collection type: base
|
||||||
|
Table QuizConnectivesCategories {
|
||||||
|
id text [pk, not null]
|
||||||
|
cat_name text
|
||||||
|
cat_image file
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_3639453778
|
||||||
|
// collection name: QuizLPCategories
|
||||||
|
// collection type: base
|
||||||
|
Table QuizLPCategories {
|
||||||
|
id text [pk, not null]
|
||||||
|
cat_name text
|
||||||
|
cat_image file
|
||||||
|
pos integer
|
||||||
|
init_answer text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
visible text
|
visible text
|
||||||
slug text
|
slug text
|
||||||
remarks text
|
remarks text
|
||||||
description text
|
description text
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listening Practice Quiz Questions
|
//
|
||||||
|
// collection id: pbc_742947356
|
||||||
|
// collection name: QuizLPQuestions
|
||||||
|
// collection type: base
|
||||||
Table QuizLPQuestions {
|
Table QuizLPQuestions {
|
||||||
id text [pk] // changed from int to text
|
id text [pk, not null]
|
||||||
created datetime [default: `now()`]
|
word text
|
||||||
|
sound file
|
||||||
|
cat_id integer [ref: > QuizLPCategories.id] // relation3870140739
|
||||||
|
created datetime
|
||||||
updated datetime
|
updated datetime
|
||||||
word text // changed from varchar to text
|
cat_name text
|
||||||
sound file // changed from blob to file
|
cat_image file
|
||||||
cat_id text [ref: > QuizLPCategories.id] // changed type and reference
|
|
||||||
cat_name text // new field
|
|
||||||
cat_image file // new field
|
|
||||||
pos number // new field
|
|
||||||
init_answer json // new field
|
|
||||||
visible text // new field
|
|
||||||
slug text // new field
|
|
||||||
remarks text // new field
|
|
||||||
description text // new field
|
|
||||||
}
|
|
||||||
|
|
||||||
// Matching Frenzy Quiz Categories
|
|
||||||
Table QuizMFCategories {
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
cat_name text // changed from varchar to text
|
|
||||||
cat_image file // changed from blob to file
|
|
||||||
pos number // changed from integer to number
|
|
||||||
init_answer json
|
|
||||||
visible text // new field
|
|
||||||
}
|
|
||||||
|
|
||||||
// Matching Frenzy Quiz Questions
|
|
||||||
Table QuizMFQuestions {
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
word text // changed from varchar to text
|
|
||||||
word_c text // changed from varchar to text
|
|
||||||
cat_id text [ref: > QuizMFCategories.id] // changed type and reference
|
|
||||||
visible text // new field
|
|
||||||
sound file // new field
|
|
||||||
cat_image file // new field
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connectives Revision Quiz Categories
|
|
||||||
Table QuizCRCategories {
|
|
||||||
id text [pk] // changed from int to text
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
cat_name text // changed from varchar to text
|
|
||||||
cat_image file // changed from blob to file
|
|
||||||
pos integer
|
pos integer
|
||||||
init_answer json
|
init_answer text
|
||||||
|
visible text
|
||||||
|
slug text
|
||||||
|
remarks text
|
||||||
|
description text
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connectives Revision Quiz Questions
|
//
|
||||||
Table QuizCRQuestions {
|
// collection id: pbc_2511066072
|
||||||
id text [pk] // changed from int to text
|
// collection name: QuizListenings
|
||||||
created datetime [default: `now()`]
|
// collection type: base
|
||||||
|
Table QuizListenings {
|
||||||
|
id text [pk, not null]
|
||||||
|
sound file
|
||||||
|
word text
|
||||||
|
cat_id integer [ref: > QuizCategories.id] // relation3870140739
|
||||||
|
created datetime
|
||||||
updated datetime
|
updated datetime
|
||||||
question_fh text // changed from varchar to text
|
|
||||||
question_sh text // changed from varchar to text
|
|
||||||
modal_ans text // changed from varchar to text
|
|
||||||
cat_id text [ref: > QuizCRCategories.id] // changed type and reference
|
|
||||||
options json // new field
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test table
|
//
|
||||||
Table t1 {
|
// collection id: pbc_84667061
|
||||||
id text [pk] // changed from int to text
|
// collection name: QuizMFCategories
|
||||||
created datetime [default: `now()`]
|
// collection type: base
|
||||||
|
Table QuizMFCategories {
|
||||||
|
id text [pk, not null]
|
||||||
|
cat_name text
|
||||||
|
cat_image file
|
||||||
|
pos integer
|
||||||
|
init_answer text
|
||||||
|
created datetime
|
||||||
updated datetime
|
updated datetime
|
||||||
hello text // changed from name to hello
|
visible text
|
||||||
test_file file // new field
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Customers table
|
//
|
||||||
Table Customers {
|
// collection id: pbc_3346420851
|
||||||
id text [pk] // new table
|
// collection name: QuizMFQuestions
|
||||||
created datetime [default: `now()`]
|
// collection type: base
|
||||||
|
Table QuizMFQuestions {
|
||||||
|
id text [pk, not null]
|
||||||
|
word text
|
||||||
|
word_c text
|
||||||
|
cat_id integer [ref: > QuizMFCategories.id] // relation3870140739
|
||||||
|
created datetime
|
||||||
updated datetime
|
updated datetime
|
||||||
|
visible text
|
||||||
|
sound file
|
||||||
|
cat_image file
|
||||||
|
init_answer text
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_2936646783
|
||||||
|
// collection name: QuizMatchings
|
||||||
|
// collection type: base
|
||||||
|
Table QuizMatchings {
|
||||||
|
id text [pk, not null]
|
||||||
|
word text
|
||||||
|
word_c text
|
||||||
|
cat_id integer [ref: > QuizCategories.id] // relation3870140739
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_491894781
|
||||||
|
// collection name: Students
|
||||||
|
// collection type: base
|
||||||
|
Table Students {
|
||||||
|
id text [pk, not null]
|
||||||
name text
|
name text
|
||||||
email text
|
email text
|
||||||
phone text
|
phone text
|
||||||
quota number
|
quota integer
|
||||||
status text
|
status text
|
||||||
avatar_file file
|
avatar_file file
|
||||||
cat_id text [ref: > QuizMFCategories.id] // refer to a single user in `Users` table
|
user_id integer [ref: > users.id] // relation2809058197
|
||||||
|
billingAddress text
|
||||||
|
timezone text
|
||||||
|
language text
|
||||||
|
currency text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_1413424569
|
||||||
|
// collection name: Teachers
|
||||||
|
// collection type: base
|
||||||
|
Table Teachers {
|
||||||
|
id text [pk, not null]
|
||||||
|
name text
|
||||||
|
email text
|
||||||
|
phone text
|
||||||
|
quota integer
|
||||||
|
status text
|
||||||
|
avatar_file file
|
||||||
|
user_id integer [ref: > users.id] // relation2809058197
|
||||||
|
billingAddress text
|
||||||
|
timezone text
|
||||||
|
language text
|
||||||
|
currency text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_1305841361
|
||||||
|
// collection name: UserMetas
|
||||||
|
// collection type: base
|
||||||
|
Table UserMetas {
|
||||||
|
id text [pk, not null]
|
||||||
|
helloworld text
|
||||||
|
meta text
|
||||||
|
user_id integer [ref: > users.id] // relation2809058197
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
status text
|
||||||
|
avatar file
|
||||||
|
role text
|
||||||
|
name text
|
||||||
|
email text
|
||||||
|
phone text
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_1638686383
|
||||||
|
// collection name: Vocabularies
|
||||||
|
// collection type: base
|
||||||
|
Table Vocabularies {
|
||||||
|
id text [pk, not null]
|
||||||
|
image file
|
||||||
|
sound file
|
||||||
|
word text
|
||||||
|
word_c text
|
||||||
|
sample_e text
|
||||||
|
sample_c text
|
||||||
|
cat_id integer [ref: > Categories.id] // relation3870140739
|
||||||
|
category text
|
||||||
|
lesson_type_id integer [ref: > LessonsTypes.id] // relation808508980
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
visible text
|
||||||
|
type text
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_4275539003
|
||||||
|
// collection name: _authOrigins
|
||||||
|
// collection type: base
|
||||||
|
Table _authOrigins {
|
||||||
|
id text [pk, not null]
|
||||||
|
collectionRef text [not null]
|
||||||
|
recordRef text [not null]
|
||||||
|
fingerprint text [not null]
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_2281828961
|
||||||
|
// collection name: _externalAuths
|
||||||
|
// collection type: base
|
||||||
|
Table _externalAuths {
|
||||||
|
id text [pk, not null]
|
||||||
|
collectionRef text [not null]
|
||||||
|
recordRef text [not null]
|
||||||
|
provider text [not null]
|
||||||
|
providerId text [not null]
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_2279338944
|
||||||
|
// collection name: _mfas
|
||||||
|
// collection type: base
|
||||||
|
Table _mfas {
|
||||||
|
id text [pk, not null]
|
||||||
|
collectionRef text [not null]
|
||||||
|
recordRef text [not null]
|
||||||
|
method text [not null]
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_1638494021
|
||||||
|
// collection name: _otps
|
||||||
|
// collection type: base
|
||||||
|
Table _otps {
|
||||||
|
id text [pk, not null]
|
||||||
|
collectionRef text [not null]
|
||||||
|
recordRef text [not null]
|
||||||
|
password varchar [not null]
|
||||||
|
sentTo text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_1509025625
|
||||||
|
// collection name: billingAddress
|
||||||
|
// collection type: base
|
||||||
|
Table billingAddress {
|
||||||
|
id text [pk, not null]
|
||||||
|
country text
|
||||||
|
state text
|
||||||
|
city text
|
||||||
|
zipCode text
|
||||||
|
line1 text
|
||||||
|
line2 text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_123408445
|
||||||
|
// collection name: helloworlds
|
||||||
|
// collection type: base
|
||||||
|
Table helloworlds {
|
||||||
|
id text [pk, not null]
|
||||||
|
hello text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_2109205374
|
||||||
|
// collection name: t1
|
||||||
|
// collection type: base
|
||||||
|
Table t1 {
|
||||||
|
id text [pk, not null]
|
||||||
|
hello text
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
test_file file
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1,215 +0,0 @@
|
|||||||
// LessonTypes stores different types of lessons
|
|
||||||
// lesson_types, lesson_type
|
|
||||||
Table LessonTypes {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment] // unique identifier for the lesson type
|
|
||||||
created datetime [default: `now()`] // timestamp when the lesson type was created
|
|
||||||
updated datetime // timestamp when the lesson type was last updated
|
|
||||||
// value field
|
|
||||||
name varchar // name of the lesson type
|
|
||||||
type varchar // type category
|
|
||||||
}
|
|
||||||
|
|
||||||
// LessonCategories stores categories of lessons
|
|
||||||
// lesson_categories, lesson_category
|
|
||||||
Table LessonCategories {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment] // unique identifier for the lesson category
|
|
||||||
created datetime [default: `now()`] // timestamp when the category was created
|
|
||||||
updated datetime // timestamp when the category was last updated
|
|
||||||
// value field
|
|
||||||
cat_name varchar // image file name
|
|
||||||
cat_image varchar // image representing the category
|
|
||||||
lesson_type_id integer [ref: > LessonTypes.id] // foreign key referencing LessonTypes.id
|
|
||||||
}
|
|
||||||
|
|
||||||
Table Helloworlds {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment] // id field, increment
|
|
||||||
created datetime [default: `now()`] // record create time
|
|
||||||
updated datetime // record update time
|
|
||||||
}
|
|
||||||
|
|
||||||
Table Users {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
|
|
||||||
// value field
|
|
||||||
email varchar
|
|
||||||
emailVisibility boolean
|
|
||||||
verified boolean
|
|
||||||
name varchar
|
|
||||||
avatar blob
|
|
||||||
}
|
|
||||||
|
|
||||||
Table UserMetas {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
|
|
||||||
// value field
|
|
||||||
helloworld varchar
|
|
||||||
app_on_time_s integer
|
|
||||||
user_id integer [ref: > Users.id]
|
|
||||||
}
|
|
||||||
|
|
||||||
Table QuizCategories {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
|
|
||||||
// value field
|
|
||||||
cat_name varchar // category name
|
|
||||||
cat_image varchar // category image
|
|
||||||
}
|
|
||||||
|
|
||||||
// stores all questions of matching frenzy
|
|
||||||
Table QuizMatchings {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment] // id field, increment
|
|
||||||
created datetime [default: `now()`] // record create time
|
|
||||||
updated datetime // record update time
|
|
||||||
|
|
||||||
// value field
|
|
||||||
word varchar // modal answer
|
|
||||||
word_c varchar // question
|
|
||||||
cat_id integer [ref: > QuizCategories.id] // foreign key to QuizCategories.id
|
|
||||||
}
|
|
||||||
|
|
||||||
// QuizListening stores all listening quiz data
|
|
||||||
Table QuizListenings {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment] // id field, increment
|
|
||||||
created datetime [default: `now()`] // record create time
|
|
||||||
updated datetime // record update time
|
|
||||||
|
|
||||||
// value field
|
|
||||||
sound varchar // URL to the sound file
|
|
||||||
word varchar // The word in the quiz
|
|
||||||
cat_id integer [ref: > QuizCategories.id]
|
|
||||||
}
|
|
||||||
|
|
||||||
// stores all categories of connectives revision quiz
|
|
||||||
Table QuizConnectivesCategories {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment] // id field, increment
|
|
||||||
created datetime [default: `now()`] // record create time
|
|
||||||
updated datetime // record update time
|
|
||||||
|
|
||||||
// value field
|
|
||||||
cat_name varchar // category name
|
|
||||||
cat_image varchar // category image
|
|
||||||
}
|
|
||||||
|
|
||||||
// stores all questions of connectives revision quiz
|
|
||||||
Table QuizConnectives {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment] // id field, increment
|
|
||||||
created datetime [default: `now()`] // record create time
|
|
||||||
updated datetime // record update time
|
|
||||||
|
|
||||||
// value field
|
|
||||||
question_fh varchar // first half
|
|
||||||
question_sh varchar // second half
|
|
||||||
modal_ans varchar // modal ans
|
|
||||||
cat_id integer [ref: > QuizConnectivesCategories.id] // foreign key to QuizConnectivesCategories.id
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lessons stores all lessons in the database
|
|
||||||
Table Vocabularies {
|
|
||||||
// system field
|
|
||||||
id int [pk, increment] // unique identifier for the lesson
|
|
||||||
created datetime [default: `now()`] // timestamp when the lesson was created
|
|
||||||
updated datetime // timestamp when the lesson was last updated
|
|
||||||
|
|
||||||
// value field
|
|
||||||
image varchar // URL to the image associated with the lesson
|
|
||||||
sound varchar // URL to the sound file associated with the lesson
|
|
||||||
word varchar // The word in English
|
|
||||||
word_c varchar // The word in Chinese
|
|
||||||
sample_e varchar // Sample sentence in English using the word
|
|
||||||
sample_c varchar // Sample sentence in Chinese using the word
|
|
||||||
cat_id integer [ref: > LessonCategories.id] // foreign key referring to LessonCategories.id
|
|
||||||
category varchar // The category to which the lesson belongs
|
|
||||||
lesson_type_id integer [ref: > LessonTypes.id] // foreign key referring to LessonTypes.id
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listening Practice Quiz Categories
|
|
||||||
// store listening practice category, (LpCategories, LpCategory)
|
|
||||||
Table QuizLPCategories {
|
|
||||||
// system fields
|
|
||||||
id text [pk] // changed from int to text to match PocketBase
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
|
|
||||||
// value fields
|
|
||||||
cat_name varchar [presentable: true] // added presentable flag
|
|
||||||
cat_image file // changed from blob to file type
|
|
||||||
pos number // changed from integer to number
|
|
||||||
init_answer json
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listening Practice Quiz Questions
|
|
||||||
Table QuizLPQuestions {
|
|
||||||
id int [pk, increment]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
word varchar
|
|
||||||
sound blob
|
|
||||||
cat_id integer [ref: > QuizLPCategories.id]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Matching Frenzy Quiz Categories
|
|
||||||
Table QuizMFCategories {
|
|
||||||
id int [pk, increment]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
cat_name varchar
|
|
||||||
cat_image blob
|
|
||||||
pos integer
|
|
||||||
init_answer json
|
|
||||||
}
|
|
||||||
|
|
||||||
// Matching Frenzy Quiz Questions
|
|
||||||
Table QuizMFQuestions {
|
|
||||||
id int [pk, increment]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
word varchar
|
|
||||||
word_c varchar
|
|
||||||
cat_id integer [ref: > QuizMFCategories.id]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connectives Revision Quiz Categories
|
|
||||||
Table QuizCRCategories {
|
|
||||||
id int [pk, increment]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
cat_name varchar
|
|
||||||
cat_image blob
|
|
||||||
pos integer
|
|
||||||
init_answer json
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connectives Revision Quiz Questions
|
|
||||||
Table QuizCRQuestions {
|
|
||||||
id int [pk, increment]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
question_fh varchar
|
|
||||||
question_sh varchar
|
|
||||||
modal_ans varchar
|
|
||||||
cat_id integer [ref: > QuizCRCategories.id]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test table
|
|
||||||
Table t1 {
|
|
||||||
id int [pk, increment]
|
|
||||||
created datetime [default: `now()`]
|
|
||||||
updated datetime
|
|
||||||
name varchar
|
|
||||||
}
|
|
3875
001_documentation/Requirements/REQ0006/schema.json
Normal file
3875
001_documentation/Requirements/REQ0006/schema.json
Normal file
File diff suppressed because it is too large
Load Diff
11
001_documentation/Requirements/REQ0013/index.md
Normal file
11
001_documentation/Requirements/REQ0013/index.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
tags: cms
|
||||||
|
---
|
||||||
|
|
||||||
|
# cms dashboard
|
||||||
|
|
||||||
|
cms
|
||||||
|
|
||||||
|
## files
|
||||||
|
|
||||||
|
T.B.A.
|
11
001_documentation/Requirements/REQ0014/index.md
Normal file
11
001_documentation/Requirements/REQ0014/index.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
tags: mobile
|
||||||
|
---
|
||||||
|
|
||||||
|
# mobile client
|
||||||
|
|
||||||
|
mobile
|
||||||
|
|
||||||
|
## files
|
||||||
|
|
||||||
|
T.B.A.
|
86
001_documentation/Requirements/REQ0015/convert.js
Normal file
86
001_documentation/Requirements/REQ0015/convert.js
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
//
|
||||||
|
// # REQ0015:
|
||||||
|
// ## PURPOSE:
|
||||||
|
//
|
||||||
|
// This is a script to convert `schema.json` exported from pocketbase to dbml formatted file `schema.dbml`
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
// Load schema.json
|
||||||
|
const schemaPath = path.join(process.cwd(), "schema.json");
|
||||||
|
const schema = JSON.parse(fs.readFileSync(schemaPath, "utf8"));
|
||||||
|
|
||||||
|
// Type mapping from PocketBase to DBML/SQL
|
||||||
|
const typeMapping = {
|
||||||
|
text: "text",
|
||||||
|
number: "integer",
|
||||||
|
bool: "boolean",
|
||||||
|
email: "text",
|
||||||
|
url: "varchar",
|
||||||
|
date: "datetime",
|
||||||
|
select: "varchar",
|
||||||
|
json: "text",
|
||||||
|
file: "file",
|
||||||
|
password: "varchar",
|
||||||
|
relation: "integer", // Assuming relations are stored as integer IDs
|
||||||
|
autodate: "datetime",
|
||||||
|
};
|
||||||
|
|
||||||
|
function convertToDBML(schema) {
|
||||||
|
let dbml = "";
|
||||||
|
dbml = "// Generated at: " + new Date().toISOString();
|
||||||
|
dbml = dbml + "\n\n\n";
|
||||||
|
|
||||||
|
let collectionIdToTableMapping = {};
|
||||||
|
for (const [idx, tableDef] of Object.entries(schema)) {
|
||||||
|
collectionIdToTableMapping[tableDef.id] = tableDef.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const [idx, tableDef] of Object.entries(schema)) {
|
||||||
|
console.log({ idx });
|
||||||
|
dbml += `// \n`;
|
||||||
|
dbml += `// collection id: ${tableDef.id} \n`;
|
||||||
|
dbml += `// collection name: ${tableDef.name} \n`;
|
||||||
|
dbml += `// collection type: ${tableDef.type} \n`;
|
||||||
|
dbml += `Table ${tableDef.name} {\n`;
|
||||||
|
|
||||||
|
for (const field of tableDef.fields) {
|
||||||
|
// Get field type
|
||||||
|
let fieldType = typeMapping[field.type] || "text";
|
||||||
|
|
||||||
|
// Handle special cases
|
||||||
|
if (field.type === "number" && field.options?.max === 1) {
|
||||||
|
fieldType = "boolean";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build field definition
|
||||||
|
let line = ` ${field.name} ${fieldType}`;
|
||||||
|
|
||||||
|
// Add constraints
|
||||||
|
const constraints = [];
|
||||||
|
if (field.name === "id" || field.primary) constraints.push("pk");
|
||||||
|
if (field.required) constraints.push("not null");
|
||||||
|
if (constraints.length > 0) line += ` [${constraints.join(", ")}]`;
|
||||||
|
|
||||||
|
if (field.collectionId) {
|
||||||
|
line += ` [ref: > ${
|
||||||
|
collectionIdToTableMapping[field.collectionId]
|
||||||
|
}.id] // ${field.id}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbml += `${line}\n`;
|
||||||
|
console.log({ line });
|
||||||
|
}
|
||||||
|
|
||||||
|
dbml += "}\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return dbml;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert and save
|
||||||
|
const dbmlOutput = convertToDBML(schema);
|
||||||
|
fs.writeFileSync("schema.dbml", dbmlOutput);
|
||||||
|
console.log("DBML file generated successfully!");
|
9
001_documentation/Requirements/REQ0015/index.md
Normal file
9
001_documentation/Requirements/REQ0015/index.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
tags: mobile, cms, db, schema
|
||||||
|
---
|
||||||
|
|
||||||
|
# pocketbase json schema to dbml converter
|
||||||
|
|
||||||
|
## description
|
||||||
|
|
||||||
|
to generate a `schema.dbml` form `schema.json` exported from pocketbase
|
18
001_documentation/Requirements/REQ0015/schema.dbml
Normal file
18
001_documentation/Requirements/REQ0015/schema.dbml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// Generated at: 2025-05-06T06:24:44.009Z
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// collection id: pbc_3142635823
|
||||||
|
// collection name: helloworld
|
||||||
|
// collection type: auth
|
||||||
|
Table helloworld {
|
||||||
|
id text [pk, not null]
|
||||||
|
password varchar [not null]
|
||||||
|
tokenKey text [not null]
|
||||||
|
email text [not null]
|
||||||
|
emailVisibility boolean
|
||||||
|
verified boolean
|
||||||
|
created datetime
|
||||||
|
updated datetime
|
||||||
|
}
|
||||||
|
|
174
001_documentation/Requirements/REQ0015/schema.json
Normal file
174
001_documentation/Requirements/REQ0015/schema.json
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "pbc_3142635823",
|
||||||
|
"listRule": null,
|
||||||
|
"viewRule": null,
|
||||||
|
"createRule": null,
|
||||||
|
"updateRule": null,
|
||||||
|
"deleteRule": null,
|
||||||
|
"name": "helloworld",
|
||||||
|
"type": "auth",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"autogeneratePattern": "[a-z0-9]{15}",
|
||||||
|
"hidden": false,
|
||||||
|
"id": "text3208210256",
|
||||||
|
"max": 15,
|
||||||
|
"min": 15,
|
||||||
|
"name": "id",
|
||||||
|
"pattern": "^[a-z0-9]+$",
|
||||||
|
"presentable": false,
|
||||||
|
"primaryKey": true,
|
||||||
|
"required": true,
|
||||||
|
"system": true,
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cost": 0,
|
||||||
|
"hidden": true,
|
||||||
|
"id": "password901924565",
|
||||||
|
"max": 0,
|
||||||
|
"min": 8,
|
||||||
|
"name": "password",
|
||||||
|
"pattern": "",
|
||||||
|
"presentable": false,
|
||||||
|
"required": true,
|
||||||
|
"system": true,
|
||||||
|
"type": "password"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"autogeneratePattern": "[a-zA-Z0-9]{50}",
|
||||||
|
"hidden": true,
|
||||||
|
"id": "text2504183744",
|
||||||
|
"max": 60,
|
||||||
|
"min": 30,
|
||||||
|
"name": "tokenKey",
|
||||||
|
"pattern": "",
|
||||||
|
"presentable": false,
|
||||||
|
"primaryKey": false,
|
||||||
|
"required": true,
|
||||||
|
"system": true,
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exceptDomains": null,
|
||||||
|
"hidden": false,
|
||||||
|
"id": "email3885137012",
|
||||||
|
"name": "email",
|
||||||
|
"onlyDomains": null,
|
||||||
|
"presentable": false,
|
||||||
|
"required": true,
|
||||||
|
"system": true,
|
||||||
|
"type": "email"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": false,
|
||||||
|
"id": "bool1547992806",
|
||||||
|
"name": "emailVisibility",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": true,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": false,
|
||||||
|
"id": "bool256245529",
|
||||||
|
"name": "verified",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": true,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": false,
|
||||||
|
"id": "autodate2990389176",
|
||||||
|
"name": "created",
|
||||||
|
"onCreate": true,
|
||||||
|
"onUpdate": false,
|
||||||
|
"presentable": false,
|
||||||
|
"system": true,
|
||||||
|
"type": "autodate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": false,
|
||||||
|
"id": "autodate3332085495",
|
||||||
|
"name": "updated",
|
||||||
|
"onCreate": true,
|
||||||
|
"onUpdate": true,
|
||||||
|
"presentable": false,
|
||||||
|
"system": true,
|
||||||
|
"type": "autodate"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
"CREATE UNIQUE INDEX `idx_tokenKey_pbc_3142635823` ON `_superusers` (`tokenKey`)",
|
||||||
|
"CREATE UNIQUE INDEX `idx_email_pbc_3142635823` ON `_superusers` (`email`) WHERE `email` != ''"
|
||||||
|
],
|
||||||
|
"system": true,
|
||||||
|
"authRule": "",
|
||||||
|
"manageRule": null,
|
||||||
|
"authAlert": {
|
||||||
|
"enabled": true,
|
||||||
|
"emailTemplate": {
|
||||||
|
"subject": "Login from a new location",
|
||||||
|
"body": "<p>Hello,</p>\n<p>We noticed a login to your {APP_NAME} account from a new location.</p>\n<p>If this was you, you may disregard this email.</p>\n<p><strong>If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.</strong></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth2": {
|
||||||
|
"mappedFields": {
|
||||||
|
"id": "",
|
||||||
|
"name": "",
|
||||||
|
"username": "",
|
||||||
|
"avatarURL": ""
|
||||||
|
},
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
"passwordAuth": {
|
||||||
|
"enabled": true,
|
||||||
|
"identityFields": [
|
||||||
|
"email"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mfa": {
|
||||||
|
"enabled": false,
|
||||||
|
"duration": 1800,
|
||||||
|
"rule": ""
|
||||||
|
},
|
||||||
|
"otp": {
|
||||||
|
"enabled": false,
|
||||||
|
"duration": 180,
|
||||||
|
"length": 8,
|
||||||
|
"emailTemplate": {
|
||||||
|
"subject": "OTP for {APP_NAME}",
|
||||||
|
"body": "<p>Hello,</p>\n<p>Your one-time password is: <strong>{OTP}</strong></p>\n<p><i>If you didn't ask for the one-time password, you can ignore this email.</i></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"authToken": {
|
||||||
|
"duration": 86400
|
||||||
|
},
|
||||||
|
"passwordResetToken": {
|
||||||
|
"duration": 1800
|
||||||
|
},
|
||||||
|
"emailChangeToken": {
|
||||||
|
"duration": 1800
|
||||||
|
},
|
||||||
|
"verificationToken": {
|
||||||
|
"duration": 259200
|
||||||
|
},
|
||||||
|
"fileToken": {
|
||||||
|
"duration": 180
|
||||||
|
},
|
||||||
|
"verificationTemplate": {
|
||||||
|
"subject": "Verify your {APP_NAME} email",
|
||||||
|
"body": "<p>Hello,</p>\n<p>Thank you for joining us at {APP_NAME}.</p>\n<p>Click on the button below to verify your email address.</p>\n<p>\n <a class=\"btn\" href=\"{APP_URL}/_/#/auth/confirm-verification/{TOKEN}\" target=\"_blank\" rel=\"noopener\">Verify</a>\n</p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>"
|
||||||
|
},
|
||||||
|
"resetPasswordTemplate": {
|
||||||
|
"subject": "Reset your {APP_NAME} password",
|
||||||
|
"body": "<p>Hello,</p>\n<p>Click on the button below to reset your password.</p>\n<p>\n <a class=\"btn\" href=\"{APP_URL}/_/#/auth/confirm-password-reset/{TOKEN}\" target=\"_blank\" rel=\"noopener\">Reset password</a>\n</p>\n<p><i>If you didn't ask to reset your password, you can ignore this email.</i></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>"
|
||||||
|
},
|
||||||
|
"confirmEmailChangeTemplate": {
|
||||||
|
"subject": "Confirm your {APP_NAME} new email address",
|
||||||
|
"body": "<p>Hello,</p>\n<p>Click on the button below to confirm your new email address.</p>\n<p>\n <a class=\"btn\" href=\"{APP_URL}/_/#/auth/confirm-email-change/{TOKEN}\" target=\"_blank\" rel=\"noopener\">Confirm new email</a>\n</p>\n<p><i>If you didn't ask to change your email address, you can ignore this email.</i></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
33
001_documentation/Requirements/REQ0016/index.md
Normal file
33
001_documentation/Requirements/REQ0016/index.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
tags: cms, login-flow
|
||||||
|
---
|
||||||
|
|
||||||
|
# login flow
|
||||||
|
|
||||||
|
## description
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD;
|
||||||
|
Start-->A;
|
||||||
|
A-->B;
|
||||||
|
B-->C;
|
||||||
|
B-->D;
|
||||||
|
D-->E;
|
||||||
|
E-->F;
|
||||||
|
C-->G;
|
||||||
|
G-->A
|
||||||
|
|
||||||
|
F-->End;
|
||||||
|
|
||||||
|
A[greeting, asking username and password]
|
||||||
|
B[check if username and password is valid]
|
||||||
|
C[pasword failed]
|
||||||
|
D[pasword ok]
|
||||||
|
E[login success]
|
||||||
|
F[redirect to '/dashboard']
|
||||||
|
|
||||||
|
G[prompt user wrong username and password]
|
||||||
|
|
||||||
|
Start((start));
|
||||||
|
End((end))
|
||||||
|
```
|
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |
9
001_documentation/Requirements/REQ0017/index.md
Normal file
9
001_documentation/Requirements/REQ0017/index.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
tags: mobile, lesson
|
||||||
|
---
|
||||||
|
|
||||||
|
# lesson page documentation
|
||||||
|
|
||||||
|
it should have a lesson page
|
||||||
|
|
||||||
|

|
7
001_documentation/Requirements/REQ0018/index.md
Normal file
7
001_documentation/Requirements/REQ0018/index.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
tags: mobile, cms, db
|
||||||
|
---
|
||||||
|
|
||||||
|
# family photo of frameworks
|
||||||
|
|
||||||
|
it should have a family photo of used framework
|
@@ -1,50 +1,21 @@
|
|||||||
# Requirements Index
|
# Requirements Index
|
||||||
|
|
||||||
## REQ0001: project overview
|
- [REQ0001: project overview](./REQ0001/index.md)
|
||||||
|
- [REQ0002: time tracking](./REQ0002/index.md)
|
||||||
[View Requirement](./REQ0001/index.md)
|
- [REQ0003: quiz page documentation](./REQ0003/index.md)
|
||||||
|
- [REQ0004: record page documentation](./REQ0004/index.md)
|
||||||
## REQ0002: lesson page documentation
|
- [REQ0005: settings page documentation](./REQ0005/index.md)
|
||||||
|
- [REQ0006: task](./REQ0006/008_update_dbml_from_json.md)
|
||||||
[View Requirement](./REQ0002/index.md)
|
- [REQ0006: GUIDELINES](./REQ0006/_GUIDELINE.md)
|
||||||
|
- [REQ0006: db schema design](./REQ0006/index.md)
|
||||||
## REQ0003: quiz page documentation
|
- [REQ0007: testing of mobile app home](./REQ0007/index.md)
|
||||||
|
- [REQ0008: schema design](./REQ0008/index.md)
|
||||||
[View Requirement](./REQ0003/index.md)
|
- [REQ0009: loading screen](./REQ0009/index.md)
|
||||||
|
- [REQ0010: user friendly error messages](./REQ0010/index.md)
|
||||||
## REQ0004: record page documentation
|
- [REQ0011: developer friendly error messages](./REQ0011/index.md)
|
||||||
|
- [REQ0012: cms navigation system](./REQ0012/index.md)
|
||||||
[View Requirement](./REQ0004/index.md)
|
- [REQ0013: cms dashboard](./REQ0013/index.md)
|
||||||
|
- [REQ0014: mobile client](./REQ0014/index.md)
|
||||||
## REQ0005: settings page documentation
|
- [REQ0015: pocketbase json schema to dbml converter](./REQ0015/index.md)
|
||||||
|
- [REQ0016: login flow](./REQ0016/index.md)
|
||||||
[View Requirement](./REQ0005/index.md)
|
- [REQ0017: lesson page documentation](./REQ0017/index.md)
|
||||||
|
|
||||||
## REQ0006: db schema design
|
|
||||||
|
|
||||||
[View Requirement](./REQ0006/index.md)
|
|
||||||
|
|
||||||
## REQ0007: testing of mobile app home
|
|
||||||
|
|
||||||
[View Requirement](./REQ0007/index.md)
|
|
||||||
|
|
||||||
## REQ0008: schema design
|
|
||||||
|
|
||||||
[View Requirement](./REQ0008/index.md)
|
|
||||||
|
|
||||||
## REQ0009: loading screen
|
|
||||||
|
|
||||||
[View Requirement](./REQ0009/index.md)
|
|
||||||
|
|
||||||
## REQ0010: user friendly error messages
|
|
||||||
|
|
||||||
[View Requirement](./REQ0010/index.md)
|
|
||||||
|
|
||||||
## REQ0011: developer friendly error messages
|
|
||||||
|
|
||||||
[View Requirement](./REQ0011/index.md)
|
|
||||||
|
|
||||||
## REQ0012: cms navigation system
|
|
||||||
|
|
||||||
[View Requirement](./REQ0012/index.md)
|
|
||||||
|
|
||||||
|
5
001_documentation/Requirements/update.sh
Executable file
5
001_documentation/Requirements/update.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
npx nodemon --delay 0.1 --ext md,js --ignore ./index.md --exec "node ./update_req_index.js"
|
@@ -36,8 +36,8 @@ async function updateIndex() {
|
|||||||
const heading = extractH1(content);
|
const heading = extractH1(content);
|
||||||
|
|
||||||
if (heading) {
|
if (heading) {
|
||||||
indexContent += `## ${dir}: ${heading}\n\n`;
|
indexContent += `- [${dir}: ${heading}](./${dir}/${file})\n`;
|
||||||
indexContent += `[View Requirement](./${dir}/${file})\n\n`;
|
// indexContent += `[View Requirement](./${dir}/${file})\n\n`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
14
002_source/.env
Normal file
14
002_source/.env
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# THIS IS env file for use with docker-compose.yml
|
||||||
|
|
||||||
|
# cms
|
||||||
|
|
||||||
|
# doc
|
||||||
|
|
||||||
|
# ionic_mobile
|
||||||
|
|
||||||
|
# api_ts
|
||||||
|
|
||||||
|
# pocketbase
|
||||||
|
PB_HOSTNAME=pocketbase
|
||||||
|
PB_USERNAME=admin@123.com
|
||||||
|
PB_PASSWORD=Aa12345678
|
4
002_source/.gitignore
vendored
Normal file
4
002_source/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
**/*.del
|
||||||
|
**/*.log
|
||||||
|
**/_archive
|
||||||
|
**/_del
|
74
002_source/README.md
Normal file
74
002_source/README.md
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# README
|
||||||
|
|
||||||
|
## to start production
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# start docker before hand
|
||||||
|
$ ./dc_build.sh
|
||||||
|
|
||||||
|
$ ./dc_up.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## to start develop
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#
|
||||||
|
$ ./dc_build.sh
|
||||||
|
$ ./dc_dev.sh
|
||||||
|
$ docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d pocketbase api_ts --remove-orphans
|
||||||
|
$ docker compose logs -f pocketbase api_ts
|
||||||
|
```
|
||||||
|
|
||||||
|
## test api endpoint
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# browse to http://localhost:3000/helloworld
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# start docker before hand
|
||||||
|
|
||||||
|
$ cd 002_source
|
||||||
|
$ ./dev.sh
|
||||||
|
|
||||||
|
# docker containers up
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## deprecated
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# mobile
|
||||||
|
$ cd 002_source/mobile
|
||||||
|
$ pnpm run dev
|
||||||
|
|
||||||
|
# cms
|
||||||
|
$ cd 002_source/cms
|
||||||
|
$ npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
ideation
|
||||||
|
prototyping
|
||||||
|
testing
|
||||||
|
production deployment
|
||||||
|
evaluation
|
||||||
|
monitoring
|
||||||
|
|
||||||
|
## addresses
|
||||||
|
|
||||||
|
```
|
||||||
|
mobile:
|
||||||
|
http://localhost:5173
|
||||||
|
|
||||||
|
pocketbase:
|
||||||
|
http://localhost:8090/_
|
||||||
|
|
||||||
|
cms:
|
||||||
|
http://localhost:3000
|
||||||
|
|
||||||
|
documentation
|
||||||
|
http://localhost:3001
|
||||||
|
```
|
||||||
|
|
||||||
|
extend to vocabularies
|
@@ -28,9 +28,7 @@ const config = {
|
|||||||
'',
|
'',
|
||||||
'^[./]',
|
'^[./]',
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: ['@ianvs/prettier-plugin-sort-imports'],
|
||||||
// '@ianvs/prettier-plugin-sort-imports'
|
|
||||||
],
|
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ['*.tsx'],
|
files: ['*.tsx'],
|
||||||
|
3
002_source/cms/public/locales/de/teachers.json
Normal file
3
002_source/cms/public/locales/de/teachers.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"back-to-list": "Teachers"
|
||||||
|
}
|
@@ -1,3 +1,6 @@
|
|||||||
{
|
{
|
||||||
"languageChanged": "Sprache geändert"
|
"languageChanged": "Sprache geändert",
|
||||||
|
"teachers": {
|
||||||
|
"back-to-list": "Lehrer"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"hello": "world"
|
"hello": "world",
|
||||||
}
|
"teachers": "teachers"
|
||||||
|
}
|
||||||
|
3
002_source/cms/public/locales/dev/teachers.json
Normal file
3
002_source/cms/public/locales/dev/teachers.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"back-to-list": "Teachers"
|
||||||
|
}
|
3
002_source/cms/public/locales/en/teachers.json
Normal file
3
002_source/cms/public/locales/en/teachers.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"back-to-list": "Teachers"
|
||||||
|
}
|
@@ -1,3 +1,7 @@
|
|||||||
{
|
{
|
||||||
"languageChanged": "Language changed"
|
"languageChanged": "Language changed",
|
||||||
|
"teachers": {
|
||||||
|
"nav-title": "teachers",
|
||||||
|
"back-to-list": "Teachers"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
3
002_source/cms/public/locales/es/teachers.json
Normal file
3
002_source/cms/public/locales/es/teachers.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"back-to-list": "Teachers"
|
||||||
|
}
|
@@ -1,3 +1,6 @@
|
|||||||
{
|
{
|
||||||
"languageChanged": "Idioma cambiado"
|
"languageChanged": "Idioma cambiado",
|
||||||
|
"teachers": {
|
||||||
|
"back-to-list": "Profesores"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,558 +0,0 @@
|
|||||||
This file is a merged representation of the entire codebase, combined into a single document by Repomix.
|
|
||||||
|
|
||||||
<file_summary>
|
|
||||||
This section contains a summary of this file.
|
|
||||||
|
|
||||||
<purpose>
|
|
||||||
This file contains a packed representation of the entire repository's contents.
|
|
||||||
It is designed to be easily consumable by AI systems for analysis, code review,
|
|
||||||
or other automated processes.
|
|
||||||
</purpose>
|
|
||||||
|
|
||||||
<file_format>
|
|
||||||
The content is organized as follows:
|
|
||||||
1. This summary section
|
|
||||||
2. Repository information
|
|
||||||
3. Directory structure
|
|
||||||
4. Repository files, each consisting of:
|
|
||||||
- File path as an attribute
|
|
||||||
- Full contents of the file
|
|
||||||
</file_format>
|
|
||||||
|
|
||||||
<usage_guidelines>
|
|
||||||
- This file should be treated as read-only. Any changes should be made to the
|
|
||||||
original repository files, not this packed version.
|
|
||||||
- When processing this file, use the file path to distinguish
|
|
||||||
between different files in the repository.
|
|
||||||
- Be aware that this file may contain sensitive information. Handle it with
|
|
||||||
the same level of security as you would the original repository.
|
|
||||||
</usage_guidelines>
|
|
||||||
|
|
||||||
<notes>
|
|
||||||
- Some files may have been excluded based on .gitignore rules and Repomix's configuration
|
|
||||||
- Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files
|
|
||||||
- Files matching patterns in .gitignore are excluded
|
|
||||||
- Files matching default ignore patterns are excluded
|
|
||||||
- Files are sorted by Git change count (files with more changes are at the bottom)
|
|
||||||
</notes>
|
|
||||||
|
|
||||||
<additional_info>
|
|
||||||
|
|
||||||
</additional_info>
|
|
||||||
|
|
||||||
</file_summary>
|
|
||||||
|
|
||||||
<directory_structure>
|
|
||||||
AddressCard/
|
|
||||||
index.tsx
|
|
||||||
SampleAddresses.tsx
|
|
||||||
BasicDetailCard/
|
|
||||||
index.tsx
|
|
||||||
Notifications/
|
|
||||||
index.tsx
|
|
||||||
type.d.ts
|
|
||||||
PaymentCard/
|
|
||||||
index.tsx
|
|
||||||
SamplePayments.tsx
|
|
||||||
SecurityCard/
|
|
||||||
index.tsx
|
|
||||||
TitleCard/
|
|
||||||
index.tsx
|
|
||||||
Helloworld.tsx
|
|
||||||
</directory_structure>
|
|
||||||
|
|
||||||
<files>
|
|
||||||
This section contains the contents of the repository's files.
|
|
||||||
|
|
||||||
<file path="AddressCard/index.tsx">
|
|
||||||
'use client';
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
import Avatar from '@mui/material/Avatar';
|
|
||||||
import Button from '@mui/material/Button';
|
|
||||||
import Card from '@mui/material/Card';
|
|
||||||
import CardContent from '@mui/material/CardContent';
|
|
||||||
import CardHeader from '@mui/material/CardHeader';
|
|
||||||
import Grid from '@mui/material/Unstable_Grid2';
|
|
||||||
import { House as HouseIcon } from '@phosphor-icons/react/dist/ssr/House';
|
|
||||||
import { Plus as PlusIcon } from '@phosphor-icons/react/dist/ssr/Plus';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
import type { Address } from '@/types/Address';
|
|
||||||
import { ShippingAddress } from '@/components/dashboard/lp/categories/shipping-address';
|
|
||||||
|
|
||||||
import { SampleAddresses } from './SampleAddresses';
|
|
||||||
|
|
||||||
export default function SampleAddressCard(): React.JSX.Element {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
return (
|
|
||||||
<Card>
|
|
||||||
<CardHeader
|
|
||||||
action={
|
|
||||||
<Button
|
|
||||||
color="secondary"
|
|
||||||
startIcon={<PlusIcon />}
|
|
||||||
>
|
|
||||||
{t('list.add')}
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
avatar={
|
|
||||||
<Avatar>
|
|
||||||
<HouseIcon fontSize="var(--Icon-fontSize)" />
|
|
||||||
</Avatar>
|
|
||||||
}
|
|
||||||
title={t('list.shipping-addresses')}
|
|
||||||
/>
|
|
||||||
<CardContent>
|
|
||||||
<Grid
|
|
||||||
container
|
|
||||||
spacing={3}
|
|
||||||
>
|
|
||||||
{(SampleAddresses satisfies Address[]).map((address) => (
|
|
||||||
<Grid
|
|
||||||
key={address.id}
|
|
||||||
md={6}
|
|
||||||
xs={12}
|
|
||||||
>
|
|
||||||
<ShippingAddress address={address} />
|
|
||||||
</Grid>
|
|
||||||
))}
|
|
||||||
</Grid>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</file>
|
|
||||||
|
|
||||||
<file path="AddressCard/SampleAddresses.tsx">
|
|
||||||
'use client';
|
|
||||||
|
|
||||||
import type { Address } from '@/types/Address';
|
|
||||||
|
|
||||||
export const SampleAddresses: Address[] = [
|
|
||||||
{
|
|
||||||
id: 'ADR-001',
|
|
||||||
country: 'United States',
|
|
||||||
state: 'Michigan',
|
|
||||||
city: 'Lansing',
|
|
||||||
zipCode: '48933',
|
|
||||||
street: '480 Haven Lane',
|
|
||||||
primary: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'ADR-002',
|
|
||||||
country: 'United States',
|
|
||||||
state: 'Missouri',
|
|
||||||
city: 'Springfield',
|
|
||||||
zipCode: '65804',
|
|
||||||
street: '4807 Lighthouse Drive',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
</file>
|
|
||||||
|
|
||||||
<file path="BasicDetailCard/index.tsx">
|
|
||||||
'use client';
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import Avatar from '@mui/material/Avatar';
|
|
||||||
import Card from '@mui/material/Card';
|
|
||||||
import CardHeader from '@mui/material/CardHeader';
|
|
||||||
import Chip from '@mui/material/Chip';
|
|
||||||
import Divider from '@mui/material/Divider';
|
|
||||||
import IconButton from '@mui/material/IconButton';
|
|
||||||
import LinearProgress from '@mui/material/LinearProgress';
|
|
||||||
import Stack from '@mui/material/Stack';
|
|
||||||
import Typography from '@mui/material/Typography';
|
|
||||||
import { PencilSimple as PencilSimpleIcon } from '@phosphor-icons/react/dist/ssr/PencilSimple';
|
|
||||||
import { User as UserIcon } from '@phosphor-icons/react/dist/ssr/User';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
import { PropertyItem } from '@/components/core/property-item';
|
|
||||||
import { PropertyList } from '@/components/core/property-list';
|
|
||||||
|
|
||||||
export default function BasicDetailCard({
|
|
||||||
lpCatId,
|
|
||||||
handleEditClick,
|
|
||||||
}: {
|
|
||||||
lpCatId: string;
|
|
||||||
handleEditClick: () => void;
|
|
||||||
}): React.JSX.Element {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card>
|
|
||||||
<CardHeader
|
|
||||||
action={
|
|
||||||
<IconButton
|
|
||||||
onClick={() => {
|
|
||||||
handleEditClick();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<PencilSimpleIcon />
|
|
||||||
</IconButton>
|
|
||||||
}
|
|
||||||
avatar={
|
|
||||||
<Avatar>
|
|
||||||
<UserIcon fontSize="var(--Icon-fontSize)" />
|
|
||||||
</Avatar>
|
|
||||||
}
|
|
||||||
title={t('list.basic-details')}
|
|
||||||
/>
|
|
||||||
<PropertyList
|
|
||||||
divider={<Divider />}
|
|
||||||
orientation="vertical"
|
|
||||||
sx={{ '--PropertyItem-padding': '12px 24px' }}
|
|
||||||
>
|
|
||||||
{(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
key: 'Customer ID',
|
|
||||||
value: (
|
|
||||||
<Chip
|
|
||||||
label="USR-001"
|
|
||||||
size="small"
|
|
||||||
variant="soft"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{ key: 'Name', value: 'Miron Vitold' },
|
|
||||||
{ key: 'Email', value: 'miron.vitold@domain.com' },
|
|
||||||
{ key: 'Phone', value: '(425) 434-5535' },
|
|
||||||
{ key: 'Company', value: 'Devias IO' },
|
|
||||||
{
|
|
||||||
key: 'Quota',
|
|
||||||
value: (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
spacing={2}
|
|
||||||
sx={{ alignItems: 'center' }}
|
|
||||||
>
|
|
||||||
<LinearProgress
|
|
||||||
sx={{ flex: '1 1 auto' }}
|
|
||||||
value={50}
|
|
||||||
variant="determinate"
|
|
||||||
/>
|
|
||||||
<Typography
|
|
||||||
color="text.secondary"
|
|
||||||
variant="body2"
|
|
||||||
>
|
|
||||||
50%
|
|
||||||
</Typography>
|
|
||||||
</Stack>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
] satisfies { key: string; value: React.ReactNode }[]
|
|
||||||
).map(
|
|
||||||
(item): React.JSX.Element => (
|
|
||||||
<PropertyItem
|
|
||||||
key={item.key}
|
|
||||||
name={item.key}
|
|
||||||
value={item.value}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</PropertyList>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</file>
|
|
||||||
|
|
||||||
<file path="Notifications/index.tsx">
|
|
||||||
'use client';
|
|
||||||
|
|
||||||
import { dayjs } from '@/lib/dayjs';
|
|
||||||
|
|
||||||
import type { Notification } from './type';
|
|
||||||
|
|
||||||
export const SampleNotifications: Notification[] = [
|
|
||||||
{
|
|
||||||
id: 'EV-002',
|
|
||||||
type: 'Refund request approved',
|
|
||||||
status: 'pending',
|
|
||||||
createdAt: dayjs().subtract(34, 'minute').subtract(5, 'hour').subtract(3, 'day').toDate(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'EV-001',
|
|
||||||
type: 'Order confirmation',
|
|
||||||
status: 'delivered',
|
|
||||||
createdAt: dayjs().subtract(49, 'minute').subtract(11, 'hour').subtract(4, 'day').toDate(),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
</file>
|
|
||||||
|
|
||||||
<file path="Notifications/type.d.ts">
|
|
||||||
export interface Notification {
|
|
||||||
id: string;
|
|
||||||
type: string;
|
|
||||||
status: 'delivered' | 'pending' | 'failed';
|
|
||||||
createdAt: Date;
|
|
||||||
}
|
|
||||||
</file>
|
|
||||||
|
|
||||||
<file path="PaymentCard/index.tsx">
|
|
||||||
'use client';
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
import Avatar from '@mui/material/Avatar';
|
|
||||||
import Button from '@mui/material/Button';
|
|
||||||
import Card from '@mui/material/Card';
|
|
||||||
import CardContent from '@mui/material/CardContent';
|
|
||||||
import CardHeader from '@mui/material/CardHeader';
|
|
||||||
import Divider from '@mui/material/Divider';
|
|
||||||
import { CreditCard as CreditCardIcon } from '@phosphor-icons/react/dist/ssr/CreditCard';
|
|
||||||
import { PencilSimple as PencilSimpleIcon } from '@phosphor-icons/react/dist/ssr/PencilSimple';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
import { PropertyItem } from '@/components/core/property-item';
|
|
||||||
import { PropertyList } from '@/components/core/property-list';
|
|
||||||
import { Payments } from '@/components/dashboard/lp/categories/payments';
|
|
||||||
|
|
||||||
import { SamplePayments } from './SamplePayments';
|
|
||||||
|
|
||||||
export default function SamplePaymentCard(): React.JSX.Element {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Payments
|
|
||||||
ordersValue={2069.48}
|
|
||||||
payments={SamplePayments}
|
|
||||||
refundsValue={324.5}
|
|
||||||
totalOrders={5}
|
|
||||||
/>
|
|
||||||
<Card>
|
|
||||||
<CardHeader
|
|
||||||
action={
|
|
||||||
<Button
|
|
||||||
color="secondary"
|
|
||||||
startIcon={<PencilSimpleIcon />}
|
|
||||||
>
|
|
||||||
{t('list.edit')}
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
avatar={
|
|
||||||
<Avatar>
|
|
||||||
<CreditCardIcon fontSize="var(--Icon-fontSize)" />
|
|
||||||
</Avatar>
|
|
||||||
}
|
|
||||||
title={t('list.billing-details')}
|
|
||||||
/>
|
|
||||||
<CardContent>
|
|
||||||
<Card
|
|
||||||
sx={{ borderRadius: 1 }}
|
|
||||||
variant="outlined"
|
|
||||||
>
|
|
||||||
<PropertyList
|
|
||||||
divider={<Divider />}
|
|
||||||
sx={{ '--PropertyItem-padding': '16px' }}
|
|
||||||
>
|
|
||||||
{(
|
|
||||||
[
|
|
||||||
{ key: t('Credit card'), value: '**** 4142' },
|
|
||||||
{ key: t('Country'), value: t('United States') },
|
|
||||||
{ key: t('State'), value: t('Michigan') },
|
|
||||||
{ key: t('City'), value: t('Southfield') },
|
|
||||||
{ key: t('Address'), value: t('Address') },
|
|
||||||
{ key: t('Tax ID'), value: t('Tax ID') },
|
|
||||||
] satisfies { key: string; value: React.ReactNode }[]
|
|
||||||
).map(
|
|
||||||
(item): React.JSX.Element => (
|
|
||||||
<PropertyItem
|
|
||||||
key={item.key}
|
|
||||||
name={item.key}
|
|
||||||
value={item.value}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</PropertyList>
|
|
||||||
</Card>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</file>
|
|
||||||
|
|
||||||
<file path="PaymentCard/SamplePayments.tsx">
|
|
||||||
'use client';
|
|
||||||
|
|
||||||
// import { dayjs } from 'dayjs';
|
|
||||||
import type { Payment } from '@/types/Payment';
|
|
||||||
import { dayjs } from '@/lib/dayjs';
|
|
||||||
|
|
||||||
export const SamplePayments: Payment[] = [
|
|
||||||
{
|
|
||||||
currency: 'USD',
|
|
||||||
amount: 500,
|
|
||||||
invoiceId: 'INV-005',
|
|
||||||
status: 'completed',
|
|
||||||
createdAt: dayjs().subtract(5, 'minute').subtract(1, 'hour').toDate(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
currency: 'USD',
|
|
||||||
amount: 324.5,
|
|
||||||
invoiceId: 'INV-004',
|
|
||||||
status: 'refunded',
|
|
||||||
createdAt: dayjs().subtract(21, 'minute').subtract(2, 'hour').toDate(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
currency: 'USD',
|
|
||||||
amount: 746.5,
|
|
||||||
invoiceId: 'INV-003',
|
|
||||||
status: 'completed',
|
|
||||||
createdAt: dayjs().subtract(7, 'minute').subtract(3, 'hour').toDate(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
currency: 'USD',
|
|
||||||
amount: 56.89,
|
|
||||||
invoiceId: 'INV-002',
|
|
||||||
status: 'completed',
|
|
||||||
createdAt: dayjs().subtract(48, 'minute').subtract(4, 'hour').toDate(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
currency: 'USD',
|
|
||||||
amount: 541.59,
|
|
||||||
invoiceId: 'INV-001',
|
|
||||||
status: 'completed',
|
|
||||||
createdAt: dayjs().subtract(31, 'minute').subtract(5, 'hour').toDate(),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
</file>
|
|
||||||
|
|
||||||
<file path="SecurityCard/index.tsx">
|
|
||||||
'use client';
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
import Avatar from '@mui/material/Avatar';
|
|
||||||
import Button from '@mui/material/Button';
|
|
||||||
import Card from '@mui/material/Card';
|
|
||||||
import CardContent from '@mui/material/CardContent';
|
|
||||||
import CardHeader from '@mui/material/CardHeader';
|
|
||||||
import Stack from '@mui/material/Stack';
|
|
||||||
import Typography from '@mui/material/Typography';
|
|
||||||
import { ShieldWarning as ShieldWarningIcon } from '@phosphor-icons/react/dist/ssr/ShieldWarning';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
export default function SampleSecurityCard(): React.JSX.Element {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card>
|
|
||||||
<CardHeader
|
|
||||||
avatar={
|
|
||||||
<Avatar>
|
|
||||||
<ShieldWarningIcon fontSize="var(--Icon-fontSize)" />
|
|
||||||
</Avatar>
|
|
||||||
}
|
|
||||||
title={t('list.security')}
|
|
||||||
/>
|
|
||||||
<CardContent>
|
|
||||||
<Stack spacing={1}>
|
|
||||||
<div>
|
|
||||||
<Button
|
|
||||||
color="error"
|
|
||||||
variant="contained"
|
|
||||||
>
|
|
||||||
{t('Delete account')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<Typography
|
|
||||||
color="text.secondary"
|
|
||||||
variant="body2"
|
|
||||||
>
|
|
||||||
{t('a-deleted-customer-cannot-be-restored-all-data-will-be-permanently-removed')}
|
|
||||||
</Typography>
|
|
||||||
</Stack>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</file>
|
|
||||||
|
|
||||||
<file path="TitleCard/index.tsx">
|
|
||||||
'use client';
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
import { Button } from '@mui/material';
|
|
||||||
import Avatar from '@mui/material/Avatar';
|
|
||||||
import Chip from '@mui/material/Chip';
|
|
||||||
import Stack from '@mui/material/Stack';
|
|
||||||
import Typography from '@mui/material/Typography';
|
|
||||||
import { CaretDown as CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown';
|
|
||||||
import { CheckCircle as CheckCircleIcon } from '@phosphor-icons/react/dist/ssr/CheckCircle';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
export default function SampleTitleCard(): React.JSX.Element {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
spacing={2}
|
|
||||||
sx={{ alignItems: 'center', flex: '1 1 auto' }}
|
|
||||||
>
|
|
||||||
<Avatar
|
|
||||||
src="/assets/avatar-1.png"
|
|
||||||
sx={{ '--Avatar-size': '64px' }}
|
|
||||||
>
|
|
||||||
empty
|
|
||||||
</Avatar>
|
|
||||||
<div>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
spacing={2}
|
|
||||||
sx={{ alignItems: 'center', flexWrap: 'wrap' }}
|
|
||||||
>
|
|
||||||
<Typography variant="h4">{t('list.customer-name')}</Typography>
|
|
||||||
<Chip
|
|
||||||
icon={
|
|
||||||
<CheckCircleIcon
|
|
||||||
color="var(--mui-palette-success-main)"
|
|
||||||
weight="fill"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={t('list.active')}
|
|
||||||
size="small"
|
|
||||||
variant="outlined"
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
<Typography
|
|
||||||
color="text.secondary"
|
|
||||||
variant="body1"
|
|
||||||
>
|
|
||||||
{t('list.customer-email')}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</Stack>
|
|
||||||
<div>
|
|
||||||
<Button
|
|
||||||
endIcon={<CaretDownIcon />}
|
|
||||||
variant="contained"
|
|
||||||
>
|
|
||||||
{t('list.action')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</file>
|
|
||||||
|
|
||||||
<file path="Helloworld.tsx">
|
|
||||||
'use client';
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
||||||
|
|
||||||
function Page(): React.JSX.Element {
|
|
||||||
React.useLayoutEffect(() => {
|
|
||||||
console.log('helloworld');
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return <>helloworld</>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Page;
|
|
||||||
</file>
|
|
||||||
|
|
||||||
</files>
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,10 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import type { Metadata } from 'next';
|
// import type { Metadata } from 'next';
|
||||||
import Stack from '@mui/material/Stack';
|
import Stack from '@mui/material/Stack';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { config } from '@/config';
|
import { config } from '@/config';
|
||||||
import { AccountDetails } from '@/components/dashboard/settings/account-details';
|
import { AccountDetails } from '@/components/dashboard/settings/account-details';
|
||||||
@@ -9,13 +12,15 @@ import { DeleteAccount } from '@/components/dashboard/settings/delete-account';
|
|||||||
import { Privacy } from '@/components/dashboard/settings/privacy';
|
import { Privacy } from '@/components/dashboard/settings/privacy';
|
||||||
import { ThemeSwitch } from '@/components/dashboard/settings/theme-switch';
|
import { ThemeSwitch } from '@/components/dashboard/settings/theme-switch';
|
||||||
|
|
||||||
export const metadata = { title: `Account | Settings | Dashboard | ${config.site.name}` } satisfies Metadata;
|
// export const metadata = { title: `Account | Settings | Dashboard | ${config.site.name}` } satisfies Metadata;
|
||||||
|
|
||||||
export default function Page(): React.JSX.Element {
|
export default function Page(): React.JSX.Element {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<div>
|
<div>
|
||||||
<Typography variant="h4">Account</Typography>
|
<Typography variant="h4">{t('account')}</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<AccountDetails />
|
<AccountDetails />
|
||||||
|
@@ -18,7 +18,11 @@ export default function Layout({ children }: LayoutProps): React.JSX.Element {
|
|||||||
width: 'var(--Content-width)',
|
width: 'var(--Content-width)',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Stack direction={{ xs: 'column', md: 'row' }} spacing={4} sx={{ position: 'relative' }}>
|
<Stack
|
||||||
|
direction={{ xs: 'column', md: 'row' }}
|
||||||
|
spacing={4}
|
||||||
|
sx={{ position: 'relative' }}
|
||||||
|
>
|
||||||
<SideNav />
|
<SideNav />
|
||||||
<Box sx={{ flex: '1 1 auto', minWidth: 0 }}>{children}</Box>
|
<Box sx={{ flex: '1 1 auto', minWidth: 0 }}>{children}</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
@@ -14,10 +14,11 @@ import { PhoneNotifications } from '@/components/dashboard/settings/phone-notifi
|
|||||||
|
|
||||||
export default function Page(): React.JSX.Element {
|
export default function Page(): React.JSX.Element {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<div>
|
<div>
|
||||||
<Typography variant="h4">{t('Notifications')}</Typography>
|
<Typography variant="h4">{t('notifications')}</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<EmailNotifications />
|
<EmailNotifications />
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
import Stack from '@mui/material/Stack';
|
import Stack from '@mui/material/Stack';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { config } from '@/config';
|
import { config } from '@/config';
|
||||||
import { dayjs } from '@/lib/dayjs';
|
import { dayjs } from '@/lib/dayjs';
|
||||||
@@ -9,13 +12,15 @@ import { LoginHistory } from '@/components/dashboard/settings/login-history';
|
|||||||
import { MultiFactor } from '@/components/dashboard/settings/multi-factor';
|
import { MultiFactor } from '@/components/dashboard/settings/multi-factor';
|
||||||
import { PasswordForm } from '@/components/dashboard/settings/password-form';
|
import { PasswordForm } from '@/components/dashboard/settings/password-form';
|
||||||
|
|
||||||
export const metadata = { title: `Security | Settings | Dashboard | ${config.site.name}` } satisfies Metadata;
|
// export const metadata = { title: `Security | Settings | Dashboard | ${config.site.name}` } satisfies Metadata;
|
||||||
|
|
||||||
export default function Page(): React.JSX.Element {
|
export default function Page(): React.JSX.Element {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<div>
|
<div>
|
||||||
<Typography variant="h4">Security</Typography>
|
<Typography variant="h4">{t('security')}</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<PasswordForm />
|
<PasswordForm />
|
||||||
|
@@ -1,33 +1,38 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import type { Metadata } from 'next';
|
// import type { Metadata } from 'next';
|
||||||
import Stack from '@mui/material/Stack';
|
import Stack from '@mui/material/Stack';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { config } from '@/config';
|
import { config } from '@/config';
|
||||||
import { Members } from '@/components/dashboard/settings/members';
|
import { Members } from '@/components/dashboard/settings/members';
|
||||||
|
|
||||||
export const metadata = { title: `Team | Settings | Dashboard | ${config.site.name}` } satisfies Metadata;
|
// export const metadata = { title: `Team | Settings | Dashboard | ${config.site.name}` } satisfies Metadata;
|
||||||
|
|
||||||
export default function Page(): React.JSX.Element {
|
export default function Page(): React.JSX.Element {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<div>
|
<div>
|
||||||
<Typography variant="h4">Team</Typography>
|
<Typography variant="h4">{t('team')}</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Members
|
<Members
|
||||||
members={[
|
members={[
|
||||||
{
|
{
|
||||||
id: 'USR-000',
|
id: 'USR-000',
|
||||||
name: 'Sofia Rivers',
|
name: 'team member1',
|
||||||
avatar: '/assets/avatar.png',
|
avatar: '/assets/avatar.png',
|
||||||
email: 'sofia@devias.io',
|
email: 'teamMember1@devias.io',
|
||||||
role: 'Owner',
|
role: 'Owner',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'USR-002',
|
id: 'USR-002',
|
||||||
name: 'Siegbert Gottfried',
|
name: 'team member2',
|
||||||
avatar: '/assets/avatar-2.png',
|
avatar: '/assets/avatar-2.png',
|
||||||
email: 'siegbert.gottfried@domain.com',
|
email: 'teamMember2@domain.com',
|
||||||
role: 'Standard',
|
role: 'Standard',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
@@ -0,0 +1,3 @@
|
|||||||
|
this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/students/create/page.tsx.draft` to handle `Student` record thanks, modify comments/variables/paths/functions name please
|
||||||
|
|
||||||
|
e.g. why `lessonCategories` still exist ?
|
@@ -0,0 +1 @@
|
|||||||
|
this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/students/edit/[customerId]/page.tsx.draft` to handle `Student` record thanks, modify comments/variables/paths/functions name please
|
@@ -1,4 +1,5 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
// src/app/dashboard/students/edit/[customerId]/page.tsx
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import RouterLink from 'next/link';
|
import RouterLink from 'next/link';
|
||||||
|
@@ -0,0 +1,3 @@
|
|||||||
|
this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/students/list/page.tsx.draft` to handle `Student` record thanks, modify comments/variables/paths/functions name please
|
||||||
|
|
||||||
|
e.g. why `lessonCategories` still exist ?
|
@@ -3,11 +3,10 @@
|
|||||||
|
|
||||||
// RULES:
|
// RULES:
|
||||||
// contains list page for students (Students)
|
// contains list page for students (Students)
|
||||||
// contain definition to collection only
|
|
||||||
//
|
//
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { COL_STUDENTS } from '@/constants';
|
import { COL_USER_METAS } from '@/constants';
|
||||||
import { LoadingButton } from '@mui/lab';
|
import { LoadingButton } from '@mui/lab';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import Card from '@mui/material/Card';
|
import Card from '@mui/material/Card';
|
||||||
@@ -38,8 +37,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
|
|
||||||
const { email, phone, sortDir, status } = searchParams;
|
const { email, phone, sortDir, status } = searchParams;
|
||||||
|
|
||||||
const [lessonCategoriesData, setLessonCategoriesData] = React.useState<Student[]>([]);
|
const [studentsData, setStudentsData] = React.useState<Student[]>([]);
|
||||||
//
|
|
||||||
|
|
||||||
const [isLoadingAddPage, setIsLoadingAddPage] = React.useState<boolean>(false);
|
const [isLoadingAddPage, setIsLoadingAddPage] = React.useState<boolean>(false);
|
||||||
const [showLoading, setShowLoading] = React.useState<boolean>(true);
|
const [showLoading, setShowLoading] = React.useState<boolean>(true);
|
||||||
@@ -51,24 +49,31 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
const [currentPage, setCurrentPage] = React.useState<number>(0);
|
const [currentPage, setCurrentPage] = React.useState<number>(0);
|
||||||
//
|
//
|
||||||
const [recordCount, setRecordCount] = React.useState<number>(0);
|
const [recordCount, setRecordCount] = React.useState<number>(0);
|
||||||
const [listOption, setListOption] = React.useState({});
|
const [listOption, setListOption] = React.useState({ filter: '' });
|
||||||
|
const [listSort, setListSort] = React.useState({});
|
||||||
|
|
||||||
|
function isListOptionChanged(): boolean {
|
||||||
|
return JSON.stringify(listOption) === JSON.stringify({ filter: '' });
|
||||||
|
}
|
||||||
//
|
//
|
||||||
const reloadRows = async (): Promise<void> => {
|
const reloadRows = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
|
const listOptionTeacherOnly = isListOptionChanged()
|
||||||
|
? { filter: `role = "student"` }
|
||||||
|
: { filter: [listOption.filter, `role = "student"`].join(' && ') };
|
||||||
|
|
||||||
const models: ListResult<RecordModel> = await pb
|
const models: ListResult<RecordModel> = await pb
|
||||||
.collection(COL_STUDENTS)
|
.collection(COL_USER_METAS)
|
||||||
.getList(currentPage + 1, rowsPerPage, listOption);
|
.getList(currentPage + 1, rowsPerPage, listOptionTeacherOnly);
|
||||||
const { items, totalItems } = models;
|
const { items, totalItems } = models;
|
||||||
const tempLessonTypes: Student[] = items.map((lt) => {
|
const tempStudents: Student[] = items.map((lt) => {
|
||||||
return { ...defaultStudent, ...lt };
|
return { ...defaultStudent, ...lt };
|
||||||
});
|
});
|
||||||
|
|
||||||
setLessonCategoriesData(tempLessonTypes);
|
setStudentsData(tempStudents);
|
||||||
setRecordCount(totalItems);
|
setRecordCount(totalItems);
|
||||||
setF(tempLessonTypes);
|
setF(tempStudents);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//
|
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
setShowError({
|
setShowError({
|
||||||
//
|
//
|
||||||
@@ -110,11 +115,12 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
if (email) {
|
if (email) {
|
||||||
tempFilter.push(`email ~ "%${email}%"`);
|
tempFilter.push(`email ~ "%${email}%"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (phone) {
|
if (phone) {
|
||||||
tempFilter.push(`phone ~ "%${phone}%"`);
|
tempFilter.push(`phone ~ "%${phone}%"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let preFinalListOption = {};
|
let preFinalListOption = { filter: '' };
|
||||||
if (tempFilter.length > 0) {
|
if (tempFilter.length > 0) {
|
||||||
preFinalListOption = { filter: tempFilter.join(' && ') };
|
preFinalListOption = { filter: tempFilter.join(' && ') };
|
||||||
}
|
}
|
||||||
@@ -158,7 +164,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
loading={isLoadingAddPage}
|
loading={isLoadingAddPage}
|
||||||
onClick={(): void => {
|
onClick={(): void => {
|
||||||
setIsLoadingAddPage(true);
|
setIsLoadingAddPage(true);
|
||||||
router.push(paths.dashboard.customers.create);
|
router.push(paths.dashboard.students.create);
|
||||||
}}
|
}}
|
||||||
startIcon={<PlusIcon />}
|
startIcon={<PlusIcon />}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
@@ -167,11 +173,11 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
<StudentsSelectionProvider customers={f}>
|
<StudentsSelectionProvider students={f}>
|
||||||
<Card>
|
<Card>
|
||||||
<StudentsFilters
|
<StudentsFilters
|
||||||
filters={{ email, phone, status }}
|
filters={{ email, phone, status }}
|
||||||
fullData={lessonCategoriesData}
|
fullData={studentsData}
|
||||||
sortDir={sortDir}
|
sortDir={sortDir}
|
||||||
/>
|
/>
|
||||||
<Divider />
|
<Divider />
|
||||||
|
@@ -1,80 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
import Avatar from '@mui/material/Avatar';
|
|
||||||
import Card from '@mui/material/Card';
|
|
||||||
import CardHeader from '@mui/material/CardHeader';
|
|
||||||
import Chip from '@mui/material/Chip';
|
|
||||||
import Divider from '@mui/material/Divider';
|
|
||||||
import IconButton from '@mui/material/IconButton';
|
|
||||||
import { PencilSimple as PencilSimpleIcon } from '@phosphor-icons/react/dist/ssr/PencilSimple';
|
|
||||||
import { User as UserIcon } from '@phosphor-icons/react/dist/ssr/User';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
import { PropertyItem } from '@/components/core/property-item';
|
|
||||||
import { PropertyList } from '@/components/core/property-list';
|
|
||||||
// import { CrCategory } from '@/components/dashboard/cr/categories/type';
|
|
||||||
import type { Student } from '@/components/dashboard/student/type.d';
|
|
||||||
|
|
||||||
export default function BasicDetailCard({
|
|
||||||
lpModel: model,
|
|
||||||
handleEditClick,
|
|
||||||
}: {
|
|
||||||
lpModel: Student;
|
|
||||||
handleEditClick: () => void;
|
|
||||||
}): React.JSX.Element {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card>
|
|
||||||
<CardHeader
|
|
||||||
action={
|
|
||||||
<IconButton
|
|
||||||
onClick={() => {
|
|
||||||
handleEditClick();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<PencilSimpleIcon />
|
|
||||||
</IconButton>
|
|
||||||
}
|
|
||||||
avatar={
|
|
||||||
<Avatar>
|
|
||||||
<UserIcon fontSize="var(--Icon-fontSize)" />
|
|
||||||
</Avatar>
|
|
||||||
}
|
|
||||||
title={t('list.basic-details')}
|
|
||||||
/>
|
|
||||||
<PropertyList
|
|
||||||
divider={<Divider />}
|
|
||||||
orientation="vertical"
|
|
||||||
sx={{ '--PropertyItem-padding': '12px 24px' }}
|
|
||||||
>
|
|
||||||
{(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
key: 'Customer ID',
|
|
||||||
value: (
|
|
||||||
<Chip
|
|
||||||
label={model.id}
|
|
||||||
size="small"
|
|
||||||
variant="soft"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{ key: 'Email', value: model.email },
|
|
||||||
{ key: 'Quota', value: model.quota },
|
|
||||||
{ key: 'Status', value: model.status },
|
|
||||||
] satisfies { key: string; value: React.ReactNode }[]
|
|
||||||
).map(
|
|
||||||
(item): React.JSX.Element => (
|
|
||||||
<PropertyItem
|
|
||||||
key={item.key}
|
|
||||||
name={item.key}
|
|
||||||
value={item.value}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</PropertyList>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
@@ -17,10 +17,10 @@ import { PropertyList } from '@/components/core/property-list';
|
|||||||
import type { Student } from '@/components/dashboard/student/type.d';
|
import type { Student } from '@/components/dashboard/student/type.d';
|
||||||
|
|
||||||
export default function BasicDetailCard({
|
export default function BasicDetailCard({
|
||||||
lpModel: model,
|
studentRecord: model,
|
||||||
handleEditClick,
|
handleEditClick,
|
||||||
}: {
|
}: {
|
||||||
lpModel: Student;
|
studentRecord: Student;
|
||||||
handleEditClick: () => void;
|
handleEditClick: () => void;
|
||||||
}): React.JSX.Element {
|
}): React.JSX.Element {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
@@ -13,13 +13,11 @@ import type { Student } from '@/components/dashboard/student/type.d';
|
|||||||
|
|
||||||
// import type { CrCategory } from '@/components/dashboard/cr/categories/type';
|
// import type { CrCategory } from '@/components/dashboard/cr/categories/type';
|
||||||
|
|
||||||
function getImageUrlFrRecord(record: Student): string {
|
function getImageUrlForStudent(student: Student): string {
|
||||||
// TODO: fix this
|
return `http://127.0.0.1:8090/api/files/${student.collectionId}/${student.id}/${student.avatar}`;
|
||||||
// `http://127.0.0.1:8090/api/files/${'record.collectionId'}/${'record.id'}/${'record.cat_image'}`;
|
|
||||||
return 'getImageUrlFrRecord(helloworld)';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SampleTitleCard({ lpModel }: { lpModel: Student }): React.JSX.Element {
|
export default function SampleTitleCard({ studentRecord }: { studentRecord: Student }): React.JSX.Element {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -31,7 +29,7 @@ export default function SampleTitleCard({ lpModel }: { lpModel: Student }): Reac
|
|||||||
>
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
variant="rounded"
|
variant="rounded"
|
||||||
src={getImageUrlFrRecord(lpModel)}
|
src={getImageUrlForStudent(studentRecord)}
|
||||||
sx={{ '--Avatar-size': '64px' }}
|
sx={{ '--Avatar-size': '64px' }}
|
||||||
>
|
>
|
||||||
{t('empty')}
|
{t('empty')}
|
||||||
@@ -42,7 +40,7 @@ export default function SampleTitleCard({ lpModel }: { lpModel: Student }): Reac
|
|||||||
spacing={2}
|
spacing={2}
|
||||||
sx={{ alignItems: 'center', flexWrap: 'wrap' }}
|
sx={{ alignItems: 'center', flexWrap: 'wrap' }}
|
||||||
>
|
>
|
||||||
<Typography variant="h4">{lpModel.email}</Typography>
|
<Typography variant="h4">{studentRecord.name || studentRecord.email}</Typography>
|
||||||
<Chip
|
<Chip
|
||||||
icon={
|
icon={
|
||||||
<CheckCircleIcon
|
<CheckCircleIcon
|
||||||
@@ -50,17 +48,11 @@ export default function SampleTitleCard({ lpModel }: { lpModel: Student }): Reac
|
|||||||
weight="fill"
|
weight="fill"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
label={lpModel.quota}
|
label={studentRecord.status}
|
||||||
size="small"
|
size="small"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Typography
|
|
||||||
color="text.secondary"
|
|
||||||
variant="body1"
|
|
||||||
>
|
|
||||||
{lpModel.status}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
<div>
|
<div>
|
@@ -0,0 +1,3 @@
|
|||||||
|
this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/students/view/[customerId]/page.tsx.draft` to handle `Student` record thanks, modify comments/variables/paths/functions name please
|
||||||
|
|
||||||
|
e.g. update `lpModel` names
|
@@ -30,29 +30,29 @@ import BasicDetailCard from './BasicDetailCard';
|
|||||||
import TitleCard from './TitleCard';
|
import TitleCard from './TitleCard';
|
||||||
import { defaultStudent } from '@/components/dashboard/student/_constants';
|
import { defaultStudent } from '@/components/dashboard/student/_constants';
|
||||||
import type { Student } from '@/components/dashboard/student/type.d';
|
import type { Student } from '@/components/dashboard/student/type.d';
|
||||||
import { COL_STUDENTS } from '@/constants';
|
import { COL_USER_METAS } from '@/constants';
|
||||||
|
|
||||||
export default function Page(): React.JSX.Element {
|
export default function Page(): React.JSX.Element {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
//
|
//
|
||||||
const { customerId } = useParams<{ customerId: string }>();
|
const { id: studentId } = useParams<{ id: string }>();
|
||||||
//
|
//
|
||||||
const [showLoading, setShowLoading] = React.useState<boolean>(true);
|
const [showLoading, setShowLoading] = React.useState<boolean>(true);
|
||||||
const [showError, setShowError] = React.useState({ show: false, detail: '' });
|
const [showError, setShowError] = React.useState({ show: false, detail: '' });
|
||||||
//
|
//
|
||||||
const [showLessonCategory, setShowLessonCategory] = React.useState<Student>(defaultStudent);
|
const [studentRecord, setStudentRecord] = React.useState<Student>(defaultStudent);
|
||||||
|
|
||||||
function handleEditClick(): void {
|
function handleEditClick(): void {
|
||||||
router.push(paths.dashboard.students.edit(showLessonCategory.id));
|
router.push(paths.dashboard.students.edit(studentRecord.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (customerId) {
|
if (studentId) {
|
||||||
pb.collection(COL_STUDENTS)
|
pb.collection(COL_USER_METAS)
|
||||||
.getOne(customerId)
|
.getOne(studentId)
|
||||||
.then((model: RecordModel) => {
|
.then((model: RecordModel) => {
|
||||||
setShowLessonCategory({ ...defaultStudent, ...model });
|
setStudentRecord({ ...defaultStudent, ...model });
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
@@ -64,9 +64,9 @@ export default function Page(): React.JSX.Element {
|
|||||||
setShowLoading(false);
|
setShowLoading(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [customerId]);
|
}, [studentId]);
|
||||||
|
|
||||||
// return <>{JSON.stringify({ showError, showLessonCategory }, null, 2)}</>;
|
// return <>{JSON.stringify({ showError, studentRecord }, null, 2)}</>;
|
||||||
|
|
||||||
if (showLoading) return <FormLoading />;
|
if (showLoading) return <FormLoading />;
|
||||||
if (showError.show)
|
if (showError.show)
|
||||||
@@ -106,7 +106,7 @@ export default function Page(): React.JSX.Element {
|
|||||||
spacing={3}
|
spacing={3}
|
||||||
sx={{ alignItems: 'flex-start' }}
|
sx={{ alignItems: 'flex-start' }}
|
||||||
>
|
>
|
||||||
<TitleCard lpModel={showLessonCategory} />
|
<TitleCard studentRecord={studentRecord} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Grid
|
<Grid
|
||||||
@@ -119,7 +119,7 @@ export default function Page(): React.JSX.Element {
|
|||||||
>
|
>
|
||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<BasicDetailCard
|
<BasicDetailCard
|
||||||
lpModel={showLessonCategory}
|
studentRecord={studentRecord}
|
||||||
handleEditClick={handleEditClick}
|
handleEditClick={handleEditClick}
|
||||||
/>
|
/>
|
||||||
<SampleSecurityCard />
|
<SampleSecurityCard />
|
@@ -0,0 +1,3 @@
|
|||||||
|
this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/teachers/list/page.tsx.draft` to handle `Teacher` record thanks, modify comments/variables/paths/functions name please
|
||||||
|
|
||||||
|
e.g. why `lessonCategories` still exist ?
|
@@ -37,7 +37,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
|
|
||||||
const { email, phone, sortDir, status } = searchParams;
|
const { email, phone, sortDir, status } = searchParams;
|
||||||
|
|
||||||
const [lessonCategoriesData, setLessonCategoriesData] = React.useState<Teacher[]>([]);
|
const [teacherData, setTeacherData] = React.useState<Teacher[]>([]);
|
||||||
|
|
||||||
const [isLoadingAddPage, setIsLoadingAddPage] = React.useState<boolean>(false);
|
const [isLoadingAddPage, setIsLoadingAddPage] = React.useState<boolean>(false);
|
||||||
const [showLoading, setShowLoading] = React.useState<boolean>(true);
|
const [showLoading, setShowLoading] = React.useState<boolean>(true);
|
||||||
@@ -53,7 +53,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
const [listSort, setListSort] = React.useState({});
|
const [listSort, setListSort] = React.useState({});
|
||||||
|
|
||||||
function isListOptionChanged() {
|
function isListOptionChanged() {
|
||||||
return JSON.stringify(listOption) === '{}';
|
return JSON.stringify(listOption) === JSON.stringify({ filter: '' });
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
const reloadRows = async (): Promise<void> => {
|
const reloadRows = async (): Promise<void> => {
|
||||||
@@ -62,6 +62,8 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
? { filter: `role = "teacher"` }
|
? { filter: `role = "teacher"` }
|
||||||
: { filter: [listOption.filter, `role = "teacher"`].join(' && ') };
|
: { filter: [listOption.filter, `role = "teacher"`].join(' && ') };
|
||||||
|
|
||||||
|
console.log({ listOptionTeacherOnly });
|
||||||
|
|
||||||
const models: ListResult<RecordModel> = await pb
|
const models: ListResult<RecordModel> = await pb
|
||||||
.collection(COL_USER_METAS)
|
.collection(COL_USER_METAS)
|
||||||
.getList(currentPage + 1, rowsPerPage, listOptionTeacherOnly);
|
.getList(currentPage + 1, rowsPerPage, listOptionTeacherOnly);
|
||||||
@@ -70,12 +72,13 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
return { ...defaultTeacher, ...lt };
|
return { ...defaultTeacher, ...lt };
|
||||||
});
|
});
|
||||||
|
|
||||||
setLessonCategoriesData(tempTeacher);
|
setTeacherData(tempTeacher);
|
||||||
setRecordCount(totalItems);
|
setRecordCount(totalItems);
|
||||||
setF(tempTeacher);
|
setF(tempTeacher);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
setShowError({
|
setShowError({
|
||||||
|
//
|
||||||
show: true,
|
show: true,
|
||||||
detail: JSON.stringify(error, null, 2),
|
detail: JSON.stringify(error, null, 2),
|
||||||
});
|
});
|
||||||
@@ -100,8 +103,8 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
}, [currentPage, rowsPerPage, listOption]);
|
}, [currentPage, rowsPerPage, listOption]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
let tempFilter = [],
|
let tempFilter = [];
|
||||||
tempSortDir = '';
|
let tempSortDir = '';
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
tempFilter.push(`status = "${status}"`);
|
tempFilter.push(`status = "${status}"`);
|
||||||
@@ -119,7 +122,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
tempFilter.push(`phone ~ "%${phone}%"`);
|
tempFilter.push(`phone ~ "%${phone}%"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let preFinalListOption = {};
|
let preFinalListOption = { filter: '' };
|
||||||
if (tempFilter.length > 0) {
|
if (tempFilter.length > 0) {
|
||||||
preFinalListOption = { filter: tempFilter.join(' && ') };
|
preFinalListOption = { filter: tempFilter.join(' && ') };
|
||||||
}
|
}
|
||||||
@@ -176,7 +179,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
<Card>
|
<Card>
|
||||||
<TeachersFilters
|
<TeachersFilters
|
||||||
filters={{ email, phone, status }}
|
filters={{ email, phone, status }}
|
||||||
fullData={lessonCategoriesData}
|
fullData={teacherData}
|
||||||
sortDir={sortDir}
|
sortDir={sortDir}
|
||||||
/>
|
/>
|
||||||
<Divider />
|
<Divider />
|
||||||
@@ -205,5 +208,11 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface PageProps {
|
interface PageProps {
|
||||||
searchParams: { email?: string; phone?: string; sortDir?: 'asc' | 'desc'; status?: string };
|
searchParams: {
|
||||||
|
email?: string;
|
||||||
|
phone?: string;
|
||||||
|
sortDir?: 'asc' | 'desc';
|
||||||
|
status?: string;
|
||||||
|
//
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,216 @@
|
|||||||
|
// src/app/dashboard/teachers/list/page.tsx
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
// RULES:
|
||||||
|
// contains list page for teachers (Teachers)
|
||||||
|
//
|
||||||
|
import * as React from 'react';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
import { COL_USER_METAS } from '@/constants';
|
||||||
|
import { LoadingButton } from '@mui/lab';
|
||||||
|
import Box from '@mui/material/Box';
|
||||||
|
import Card from '@mui/material/Card';
|
||||||
|
import Divider from '@mui/material/Divider';
|
||||||
|
import Stack from '@mui/material/Stack';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import { Plus as PlusIcon } from '@phosphor-icons/react/dist/ssr/Plus';
|
||||||
|
import type { ListResult, RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
|
import { TeachersFilters } from '@/components/dashboard/teacher/teachers-filters';
|
||||||
|
import { TeachersPagination } from '@/components/dashboard/teacher/teachers-pagination';
|
||||||
|
import { TeachersSelectionProvider } from '@/components/dashboard/teacher/teachers-selection-context';
|
||||||
|
import { TeachersTable } from '@/components/dashboard/teacher/teachers-table';
|
||||||
|
import type { Teacher } from '@/components/dashboard/teacher/type.d';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
import { paths } from '@/paths';
|
||||||
|
import isDevelopment from '@/lib/check-is-development';
|
||||||
|
import { logger } from '@/lib/default-logger';
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
import ErrorDisplay from '@/components/dashboard/error';
|
||||||
|
import { defaultTeacher } from '@/components/dashboard/teacher/_constants';
|
||||||
|
import FormLoading from '@/components/loading';
|
||||||
|
|
||||||
|
export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||||
|
const { t } = useTranslation(['teachers']);
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const { email, phone, sortDir, status } = searchParams;
|
||||||
|
|
||||||
|
const [teacherData, setTeacherData] = React.useState<Teacher[]>([]);
|
||||||
|
|
||||||
|
const [isLoadingAddPage, setIsLoadingAddPage] = React.useState<boolean>(false);
|
||||||
|
const [showLoading, setShowLoading] = React.useState<boolean>(true);
|
||||||
|
const [showError, setShowError] = React.useState({ show: false, detail: '' });
|
||||||
|
//
|
||||||
|
const [rowsPerPage, setRowsPerPage] = React.useState<number>(5);
|
||||||
|
//
|
||||||
|
const [f, setF] = React.useState<Teacher[]>([]);
|
||||||
|
const [currentPage, setCurrentPage] = React.useState<number>(0);
|
||||||
|
//
|
||||||
|
const [recordCount, setRecordCount] = React.useState<number>(0);
|
||||||
|
const [listOption, setListOption] = React.useState({ filter: '' });
|
||||||
|
const [listSort, setListSort] = React.useState({});
|
||||||
|
|
||||||
|
function isListOptionChanged() {
|
||||||
|
return JSON.stringify(listOption) === '{}';
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const reloadRows = async (): Promise<void> => {
|
||||||
|
try {
|
||||||
|
const listOptionTeacherOnly = isListOptionChanged()
|
||||||
|
? { filter: `role = "teacher"` }
|
||||||
|
: { filter: [listOption.filter, `role = "teacher"`].join(' && ') };
|
||||||
|
|
||||||
|
const models: ListResult<RecordModel> = await pb
|
||||||
|
.collection(COL_USER_METAS)
|
||||||
|
.getList(currentPage + 1, rowsPerPage, listOptionTeacherOnly);
|
||||||
|
const { items, totalItems } = models;
|
||||||
|
const tempTeacher: Teacher[] = items.map((lt) => {
|
||||||
|
return { ...defaultTeacher, ...lt };
|
||||||
|
});
|
||||||
|
|
||||||
|
setTeacherData(tempTeacher);
|
||||||
|
setRecordCount(totalItems);
|
||||||
|
setF(tempTeacher);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error);
|
||||||
|
setShowError({
|
||||||
|
//
|
||||||
|
show: true,
|
||||||
|
detail: JSON.stringify(error, null, 2),
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setShowLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const [lastListOption, setLastListOption] = React.useState({});
|
||||||
|
const isFirstRun = React.useRef(false);
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!isFirstRun.current) {
|
||||||
|
isFirstRun.current = true;
|
||||||
|
} else if (JSON.stringify(listOption) !== JSON.stringify(lastListOption)) {
|
||||||
|
// reset page number as tab changes
|
||||||
|
setLastListOption(listOption);
|
||||||
|
setCurrentPage(0);
|
||||||
|
void reloadRows();
|
||||||
|
} else {
|
||||||
|
void reloadRows();
|
||||||
|
}
|
||||||
|
}, [currentPage, rowsPerPage, listOption]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
const tempFilter = [];
|
||||||
|
let tempSortDir = '';
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
tempFilter.push(`status = "${status}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sortDir) {
|
||||||
|
tempSortDir = `-created`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (email) {
|
||||||
|
tempFilter.push(`email ~ "%${email}%"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phone) {
|
||||||
|
tempFilter.push(`phone ~ "%${phone}%"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let preFinalListOption = { filter: '' };
|
||||||
|
if (tempFilter.length > 0) {
|
||||||
|
preFinalListOption = { filter: tempFilter.join(' && ') };
|
||||||
|
}
|
||||||
|
if (tempSortDir.length > 0) {
|
||||||
|
preFinalListOption = { ...preFinalListOption, sort: tempSortDir };
|
||||||
|
}
|
||||||
|
setListOption(preFinalListOption);
|
||||||
|
}, [sortDir, email, phone, status]);
|
||||||
|
|
||||||
|
if (showLoading) return <FormLoading />;
|
||||||
|
|
||||||
|
if (showError.show)
|
||||||
|
return (
|
||||||
|
<ErrorDisplay
|
||||||
|
message={t('error.unable-to-process-request')}
|
||||||
|
code={-1}
|
||||||
|
details={showError.detail}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
maxWidth: 'var(--Content-maxWidth)',
|
||||||
|
m: 'var(--Content-margin)',
|
||||||
|
p: 'var(--Content-padding)',
|
||||||
|
width: 'var(--Content-width)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack spacing={4}>
|
||||||
|
<Stack
|
||||||
|
direction={{ xs: 'column', sm: 'row' }}
|
||||||
|
spacing={3}
|
||||||
|
sx={{ alignItems: 'flex-start' }}
|
||||||
|
>
|
||||||
|
<Box sx={{ flex: '1 1 auto' }}>
|
||||||
|
<Typography variant="h4">{t('list.title')}</Typography>
|
||||||
|
</Box>
|
||||||
|
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
|
||||||
|
<LoadingButton
|
||||||
|
loading={isLoadingAddPage}
|
||||||
|
onClick={(): void => {
|
||||||
|
setIsLoadingAddPage(true);
|
||||||
|
router.push(paths.dashboard.teachers.create);
|
||||||
|
}}
|
||||||
|
startIcon={<PlusIcon />}
|
||||||
|
variant="contained"
|
||||||
|
>
|
||||||
|
{t('list.add')}
|
||||||
|
</LoadingButton>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
<TeachersSelectionProvider teachers={f}>
|
||||||
|
<Card>
|
||||||
|
<TeachersFilters
|
||||||
|
filters={{ email, phone, status }}
|
||||||
|
fullData={teacherData}
|
||||||
|
sortDir={sortDir}
|
||||||
|
/>
|
||||||
|
<Divider />
|
||||||
|
<Box sx={{ overflowX: 'auto' }}>
|
||||||
|
<TeachersTable
|
||||||
|
reloadRows={reloadRows}
|
||||||
|
rows={f}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
<Divider />
|
||||||
|
<TeachersPagination
|
||||||
|
count={recordCount}
|
||||||
|
page={currentPage}
|
||||||
|
rowsPerPage={rowsPerPage}
|
||||||
|
setPage={setCurrentPage}
|
||||||
|
setRowsPerPage={setRowsPerPage}
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
</TeachersSelectionProvider>
|
||||||
|
</Stack>
|
||||||
|
<Box sx={{ display: isDevelopment ? 'block' : 'none' }}>
|
||||||
|
<pre>{JSON.stringify(f, null, 2)}</pre>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PageProps {
|
||||||
|
searchParams: {
|
||||||
|
email?: string;
|
||||||
|
phone?: string;
|
||||||
|
sortDir?: 'asc' | 'desc';
|
||||||
|
status?: string;
|
||||||
|
//
|
||||||
|
};
|
||||||
|
}
|
@@ -9,18 +9,15 @@ import Typography from '@mui/material/Typography';
|
|||||||
import { CaretDown as CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown';
|
import { CaretDown as CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown';
|
||||||
import { CheckCircle as CheckCircleIcon } from '@phosphor-icons/react/dist/ssr/CheckCircle';
|
import { CheckCircle as CheckCircleIcon } from '@phosphor-icons/react/dist/ssr/CheckCircle';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import type { Customer } from '@/components/dashboard/customer/type.d';
|
|
||||||
import { Teacher } from '@/components/dashboard/teacher/type.d';
|
import { Teacher } from '@/components/dashboard/teacher/type.d';
|
||||||
|
|
||||||
// import type { CrCategory } from '@/components/dashboard/cr/categories/type';
|
// import type { CrCategory } from '@/components/dashboard/cr/categories/type';
|
||||||
|
|
||||||
function getImageUrlFrRecord(record: Teacher): string {
|
function getImageUrlFrRecord(teacher: Teacher): string {
|
||||||
// TODO: fix this
|
return `http://127.0.0.1:8090/api/files/${teacher.collectionId}/${teacher.id}/${teacher.avatar}`;
|
||||||
// `http://127.0.0.1:8090/api/files/${'record.collectionId'}/${'record.id'}/${'record.cat_image'}`;
|
|
||||||
return `http://127.0.0.1:8090/api/files/${record.collectionId}/${record.id}/${record.avatar}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SampleTitleCard({ lpModel }: { lpModel: Customer }): React.JSX.Element {
|
export default function SampleTitleCard({ teacherRecord }: { teacherRecord: Teacher }): React.JSX.Element {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -32,7 +29,7 @@ export default function SampleTitleCard({ lpModel }: { lpModel: Customer }): Rea
|
|||||||
>
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
variant="rounded"
|
variant="rounded"
|
||||||
src={getImageUrlFrRecord(lpModel)}
|
src={getImageUrlFrRecord(teacherRecord)}
|
||||||
sx={{ '--Avatar-size': '64px' }}
|
sx={{ '--Avatar-size': '64px' }}
|
||||||
>
|
>
|
||||||
{t('empty')}
|
{t('empty')}
|
||||||
@@ -43,7 +40,7 @@ export default function SampleTitleCard({ lpModel }: { lpModel: Customer }): Rea
|
|||||||
spacing={2}
|
spacing={2}
|
||||||
sx={{ alignItems: 'center', flexWrap: 'wrap' }}
|
sx={{ alignItems: 'center', flexWrap: 'wrap' }}
|
||||||
>
|
>
|
||||||
<Typography variant="h4">{lpModel.email}</Typography>
|
<Typography variant="h4">{teacherRecord.name || teacherRecord.email}</Typography>
|
||||||
<Chip
|
<Chip
|
||||||
icon={
|
icon={
|
||||||
<CheckCircleIcon
|
<CheckCircleIcon
|
||||||
@@ -51,17 +48,11 @@ export default function SampleTitleCard({ lpModel }: { lpModel: Customer }): Rea
|
|||||||
weight="fill"
|
weight="fill"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
label={lpModel.quota}
|
label={teacherRecord.status}
|
||||||
size="small"
|
size="small"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Typography
|
|
||||||
color="text.secondary"
|
|
||||||
variant="body1"
|
|
||||||
>
|
|
||||||
{lpModel.status}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
<div>
|
<div>
|
||||||
|
@@ -0,0 +1,3 @@
|
|||||||
|
this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/teachers/view/[id]/TitleCard.tsx.draft` to handle `Teacher` record thanks, modify comments/variables/paths/functions name please
|
||||||
|
|
||||||
|
e.g. why `lessonCategories` still exist ?
|
@@ -107,7 +107,7 @@ export default function Page(): React.JSX.Element {
|
|||||||
spacing={3}
|
spacing={3}
|
||||||
sx={{ alignItems: 'flex-start' }}
|
sx={{ alignItems: 'flex-start' }}
|
||||||
>
|
>
|
||||||
<TitleCard lpModel={showLessonCategory} />
|
<TitleCard teacherRecord={showLessonCategory} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Grid
|
<Grid
|
||||||
|
@@ -24,35 +24,35 @@ import { toast } from '@/components/core/toaster';
|
|||||||
|
|
||||||
import ErrorDisplay from '@/components/dashboard/error';
|
import ErrorDisplay from '@/components/dashboard/error';
|
||||||
|
|
||||||
import { Notifications } from '@/components/dashboard/student/notifications';
|
import { Notifications } from '@/components/dashboard/teacher/notifications';
|
||||||
import FormLoading from '@/components/loading';
|
import FormLoading from '@/components/loading';
|
||||||
import BasicDetailCard from './BasicDetailCard';
|
import BasicDetailCard from './BasicDetailCard';
|
||||||
import TitleCard from './TitleCard';
|
import TitleCard from './TitleCard';
|
||||||
import { defaultStudent } from '@/components/dashboard/student/_constants';
|
import { defaultTeacher } from '@/components/dashboard/teacher/_constants';
|
||||||
import type { Student } from '@/components/dashboard/student/type.d';
|
import type { Teacher } from '@/components/dashboard/teacher/type.d';
|
||||||
import { COL_STUDENTS } from '@/constants';
|
import { COL_USER_METAS } from '@/constants';
|
||||||
|
|
||||||
export default function Page(): React.JSX.Element {
|
export default function Page(): React.JSX.Element {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation(['teachers']);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
//
|
//
|
||||||
const { customerId } = useParams<{ customerId: string }>();
|
const { id } = useParams<{ id: string }>();
|
||||||
//
|
//
|
||||||
const [showLoading, setShowLoading] = React.useState<boolean>(true);
|
const [showLoading, setShowLoading] = React.useState<boolean>(true);
|
||||||
const [showError, setShowError] = React.useState({ show: false, detail: '' });
|
const [showError, setShowError] = React.useState({ show: false, detail: '' });
|
||||||
//
|
//
|
||||||
const [showLessonCategory, setShowLessonCategory] = React.useState<Student>(defaultStudent);
|
const [teacherData, setTeacherData] = React.useState<Teacher>(defaultTeacher);
|
||||||
|
|
||||||
function handleEditClick(): void {
|
function handleEditClick(): void {
|
||||||
router.push(paths.dashboard.students.edit(showLessonCategory.id));
|
router.push(paths.dashboard.teachers.edit(teacherData.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (customerId) {
|
if (id) {
|
||||||
pb.collection(COL_STUDENTS)
|
pb.collection(COL_USER_METAS)
|
||||||
.getOne(customerId)
|
.getOne(id)
|
||||||
.then((model: RecordModel) => {
|
.then((model: RecordModel) => {
|
||||||
setShowLessonCategory({ ...defaultStudent, ...model });
|
setTeacherData({ ...defaultTeacher, ...model });
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
@@ -64,7 +64,8 @@ export default function Page(): React.JSX.Element {
|
|||||||
setShowLoading(false);
|
setShowLoading(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [customerId]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [id]);
|
||||||
|
|
||||||
// return <>{JSON.stringify({ showError, showLessonCategory }, null, 2)}</>;
|
// return <>{JSON.stringify({ showError, showLessonCategory }, null, 2)}</>;
|
||||||
|
|
||||||
@@ -93,12 +94,12 @@ export default function Page(): React.JSX.Element {
|
|||||||
<Link
|
<Link
|
||||||
color="text.primary"
|
color="text.primary"
|
||||||
component={RouterLink}
|
component={RouterLink}
|
||||||
href={paths.dashboard.students.list}
|
href={paths.dashboard.teachers.list}
|
||||||
sx={{ alignItems: 'center', display: 'inline-flex', gap: 1 }}
|
sx={{ alignItems: 'center', display: 'inline-flex', gap: 1 }}
|
||||||
variant="subtitle2"
|
variant="subtitle2"
|
||||||
>
|
>
|
||||||
<ArrowLeftIcon fontSize="var(--icon-fontSize-md)" />
|
<ArrowLeftIcon fontSize="var(--icon-fontSize-md)" />
|
||||||
Students
|
{t('back-to-list')}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<Stack
|
<Stack
|
||||||
@@ -106,7 +107,7 @@ export default function Page(): React.JSX.Element {
|
|||||||
spacing={3}
|
spacing={3}
|
||||||
sx={{ alignItems: 'flex-start' }}
|
sx={{ alignItems: 'flex-start' }}
|
||||||
>
|
>
|
||||||
<TitleCard lpModel={showLessonCategory} />
|
<TitleCard lpModel={teacherData} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Grid
|
<Grid
|
||||||
@@ -119,7 +120,7 @@ export default function Page(): React.JSX.Element {
|
|||||||
>
|
>
|
||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<BasicDetailCard
|
<BasicDetailCard
|
||||||
lpModel={showLessonCategory}
|
lpModel={teacherData}
|
||||||
handleEditClick={handleEditClick}
|
handleEditClick={handleEditClick}
|
||||||
/>
|
/>
|
||||||
<SampleSecurityCard />
|
<SampleSecurityCard />
|
@@ -3,7 +3,7 @@
|
|||||||
import type { Customer } from '@/components/dashboard/customer/type.d';
|
import type { Customer } from '@/components/dashboard/customer/type.d';
|
||||||
import { dayjs } from '@/lib/dayjs';
|
import { dayjs } from '@/lib/dayjs';
|
||||||
|
|
||||||
export const SampleCustomers = [
|
export const SampleTeachers = [
|
||||||
{
|
{
|
||||||
id: 'USR-005',
|
id: 'USR-005',
|
||||||
name: 'Fran Perez',
|
name: 'Fran Perez',
|
@@ -1,11 +1,11 @@
|
|||||||
# GUIDELINES
|
# GUIDELINES
|
||||||
|
|
||||||
this folder is part of nextjs typescript project and containing page definition for `Customer` / `Customers` record:
|
this folder is part of nextjs typescript project and containing page definition for `UserMeta` / `UserMetas` record:
|
||||||
|
|
||||||
- list (./page.tsx)
|
- list (./page.tsx)
|
||||||
- view (./[customerId]/page.tsx)
|
- view (./[userMetaId]/page.tsx)
|
||||||
- create (./create/page.tsx)
|
- create (./create/page.tsx)
|
||||||
- edit (./[customerId]/page.tsx)
|
- edit (./[userMetaId]/page.tsx)
|
||||||
- translation provided by react-i18next
|
- translation provided by react-i18next
|
||||||
|
|
||||||
the `@` sign refer to `<base_dir>/002_source/002_source/cms/src`
|
the `@` sign refer to `<base_dir>/002_source/002_source/cms/src`
|
||||||
@@ -13,17 +13,17 @@ the `@` sign refer to `<base_dir>/002_source/002_source/cms/src`
|
|||||||
## Assumption and Requirements
|
## Assumption and Requirements
|
||||||
|
|
||||||
- let one file contains one component only.
|
- let one file contains one component only.
|
||||||
- type information defined in `<base_dir>/002_source/cms/src/db/Customers/type.d.tsx`
|
- type information defined in `<base_dir>/002_source/cms/src/db/UserMetas/type.d.tsx`
|
||||||
- it mainly consume the db drivers `Customres` in `<base_dir>/002_source/cms/src/db/Customers`
|
- it mainly consume the db drivers `UserMetas` in `<base_dir>/002_source/cms/src/db/UserMetas`
|
||||||
|
|
||||||
simple template:
|
simple template:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// src/app/dashboard/customers/page.tsx
|
// src/app/dashboard/users/page.tsx
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
// RULES:
|
// RULES:
|
||||||
// contains list page for customers (Customers)
|
// contains list page for user metas (UserMetas)
|
||||||
// contain definition to collection only
|
// contain definition to collection only
|
||||||
//
|
//
|
||||||
import statements here ...
|
import statements here ...
|
||||||
@@ -44,6 +44,6 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
|||||||
|
|
||||||
|
|
||||||
interface PageProps {
|
interface PageProps {
|
||||||
searchParams: { email?: string; phone?: string; sortDir?: 'asc' | 'desc'; status?: string };
|
searchParams: { userId?: string; key?: string; sortDir?: 'asc' | 'desc'; value?: string };
|
||||||
}
|
}
|
||||||
```
|
```
|
@@ -1,5 +1,5 @@
|
|||||||
|
'use client';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import type { Metadata } from 'next';
|
|
||||||
import RouterLink from 'next/link';
|
import RouterLink from 'next/link';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import Link from '@mui/material/Link';
|
import Link from '@mui/material/Link';
|
||||||
@@ -9,9 +9,7 @@ import { ArrowLeft as ArrowLeftIcon } from '@phosphor-icons/react/dist/ssr/Arrow
|
|||||||
|
|
||||||
import { config } from '@/config';
|
import { config } from '@/config';
|
||||||
import { paths } from '@/paths';
|
import { paths } from '@/paths';
|
||||||
import { UserCreateForm } from '@/components/dashboard/user/user-create-form';
|
import { TeacherCreateForm } from '@/components/dashboard/teacher/teacher-create-form';
|
||||||
|
|
||||||
export const metadata = { title: `Create | Users | Dashboard | ${config.site.name}` } satisfies Metadata;
|
|
||||||
|
|
||||||
export default function Page(): React.JSX.Element {
|
export default function Page(): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
@@ -29,19 +27,19 @@ export default function Page(): React.JSX.Element {
|
|||||||
<Link
|
<Link
|
||||||
color="text.primary"
|
color="text.primary"
|
||||||
component={RouterLink}
|
component={RouterLink}
|
||||||
href={paths.dashboard.users.list}
|
href={paths.dashboard.teachers.list}
|
||||||
sx={{ alignItems: 'center', display: 'inline-flex', gap: 1 }}
|
sx={{ alignItems: 'center', display: 'inline-flex', gap: 1 }}
|
||||||
variant="subtitle2"
|
variant="subtitle2"
|
||||||
>
|
>
|
||||||
<ArrowLeftIcon fontSize="var(--icon-fontSize-md)" />
|
<ArrowLeftIcon fontSize="var(--icon-fontSize-md)" />
|
||||||
Users
|
Teachers
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Typography variant="h4">Create user</Typography>
|
<Typography variant="h4">Create teacher</Typography>
|
||||||
</div>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
<UserCreateForm />
|
<TeacherCreateForm />
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
@@ -0,0 +1,3 @@
|
|||||||
|
this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/user_metas/edit/[id]/page.tsx.draft` to handle `UserMeta` record thanks, modify comments/variables/paths/functions name please
|
||||||
|
|
||||||
|
e.g. why `lessonCategories` still exist ?
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user