Compare commits
6 Commits
b8e8968866
...
6884f1466f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6884f1466f | ||
![]() |
d308131a8a | ||
![]() |
b3ebe8309a | ||
![]() |
fa35ef2bef | ||
![]() |
0785fcd144 | ||
![]() |
2dcc765072 |
33
002_source/cms/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"wmaurer.change-case",
|
||||
"saoudrizwan.claude-dev",
|
||||
"naumovs.color-highlight",
|
||||
"bocovo.dbml-erd-visualizer",
|
||||
"aflalo.dbml-formatter",
|
||||
"editorconfig.editorconfig",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"ms-vscode.vscode-typescript-next",
|
||||
"tttpob.list-aligner",
|
||||
"bierner.markdown-mermaid",
|
||||
"onatm.open-in-new-window",
|
||||
"christian-kohler.path-intellisense",
|
||||
"esbenp.prettier-vscode",
|
||||
"humao.rest-client",
|
||||
"ryu1kn.text-marker",
|
||||
"gruntfuggly.todo-tree",
|
||||
"bibhasdn.unique-lines",
|
||||
"neptunedesign.vs-sequential-number",
|
||||
"matt-meyers.vscode-dbml",
|
||||
"codeium.codeium",
|
||||
"tencent-cloud.coding-copilot",
|
||||
"yzhang.markdown-all-in-one",
|
||||
"stubedston.align-text",
|
||||
"mads-hartmann.bash-ide-vscode",
|
||||
"duynvu.dbml-language",
|
||||
"mikestead.dotenv",
|
||||
"bpruitt-goddard.mermaid-markdown-syntax-highlighting",
|
||||
"davidanson.vscode-markdownlint",
|
||||
"foxundermoon.shell-format"
|
||||
]
|
||||
}
|
@@ -2,19 +2,26 @@ Hi, i need your help.
|
||||
|
||||
## task
|
||||
|
||||
i am working on a dbml file
|
||||
i got a schema.json from exported from pocketbase
|
||||
and i want to update it to my current dbml file (for documentation)
|
||||
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 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.
|
||||
|
||||
## information
|
||||
|
||||
json file: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/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. 字段类型映射是否有特殊规则? 沒有
|
||||
|
||||
thanks
|
||||
|
@@ -5,6 +5,34 @@ tags: db, driver
|
||||
# clone db driver
|
||||
|
||||
please understand the tsx files in folder
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Teachers`
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Notifications`
|
||||
|
||||
change all occurrence of `customer` to `teacher` thanks.
|
||||
change all occurrence of `customer` to `notification` thanks.
|
||||
|
||||
## FAQ
|
||||
|
||||
1. 在constants.ts中是否已定义COL_NOTIFICATIONS常量?没有,需要先定义它。
|
||||
2. Notification相关的类型定义在哪里?是在现有文件中还是需要新建? 需要新建
|
||||
3. 是否需要保留原始Customer驱动文件,还是完全替换为Notification驱动?
|
||||
用 `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Notifications` 中的 code
|
||||
|
||||
请确认这些信息,以便我制定完整的修改方案。
|
||||
|
||||
当前已确认需要修改的内容包括:
|
||||
|
||||
函数名中的customer → notification
|
||||
COL_CUSTOMERS → COL_NOTIFICATIONS
|
||||
相关类型引用
|
||||
注释中的customer → notification
|
||||
|
||||
---
|
||||
|
||||
<!-- updat type.d -->
|
||||
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Notifications/type.d.ts` the fields is currently wrong, please help to update thanks.
|
||||
|
||||
update the `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Notifications/EmptyNotification.ts` as well thanks.
|
||||
|
||||
---
|
||||
|
||||
please draft `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Notifications/GetNotificationByUserId.tsx` by reference `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Notifications/GetById.tsx`
|
||||
|
@@ -18,46 +18,14 @@ import { X as XIcon } from '@phosphor-icons/react/dist/ssr/X';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { dayjs } from '@/lib/dayjs';
|
||||
|
||||
export type Notification = { id: string; createdAt: Date; read: boolean } & (
|
||||
| { type: 'new_feature'; description: string }
|
||||
| { type: 'new_company'; author: { name: string; avatar?: string }; company: { name: string } }
|
||||
| { type: 'new_job'; author: { name: string; avatar?: string }; job: { title: string } }
|
||||
);
|
||||
|
||||
const notifications = [
|
||||
{
|
||||
id: 'EV-004',
|
||||
createdAt: dayjs().subtract(7, 'minute').subtract(5, 'hour').subtract(1, 'day').toDate(),
|
||||
read: false,
|
||||
type: 'new_job',
|
||||
author: { name: 'Jie Yan', avatar: '/assets/avatar-8.png' },
|
||||
job: { title: 'Remote React / React Native Developer' },
|
||||
},
|
||||
{
|
||||
id: 'EV-003',
|
||||
createdAt: dayjs().subtract(18, 'minute').subtract(3, 'hour').subtract(5, 'day').toDate(),
|
||||
read: true,
|
||||
type: 'new_job',
|
||||
author: { name: 'Fran Perez', avatar: '/assets/avatar-5.png' },
|
||||
job: { title: 'Senior Golang Backend Engineer' },
|
||||
},
|
||||
{
|
||||
id: 'EV-002',
|
||||
createdAt: dayjs().subtract(4, 'minute').subtract(5, 'hour').subtract(7, 'day').toDate(),
|
||||
read: true,
|
||||
type: 'new_feature',
|
||||
description: 'Logistics management is now available',
|
||||
},
|
||||
{
|
||||
id: 'EV-001',
|
||||
createdAt: dayjs().subtract(7, 'minute').subtract(8, 'hour').subtract(7, 'day').toDate(),
|
||||
read: true,
|
||||
type: 'new_company',
|
||||
author: { name: 'Jie Yan', avatar: '/assets/avatar-8.png' },
|
||||
company: { name: 'Stripe' },
|
||||
},
|
||||
] satisfies Notification[];
|
||||
// import type { Notification } from './type.d.tsx.del';
|
||||
import { SampleNotifications } from './sample-notifications';
|
||||
import { useHelloworld } from '@/hooks/use-helloworld';
|
||||
import { getAllNotifications } from '@/db/Notifications/GetAll';
|
||||
import { ListResult, RecordModel } from 'pocketbase';
|
||||
import { defaultNotification } from '@/db/Notifications/constants';
|
||||
import { getNotificationsByUserId } from '@/db/Notifications/GetNotificationByUserId';
|
||||
import { Notification } from '@/db/Notifications/type';
|
||||
|
||||
export interface NotificationsPopoverProps {
|
||||
anchorEl: null | Element;
|
||||
@@ -75,6 +43,38 @@ export function NotificationsPopover({
|
||||
open = false,
|
||||
}: NotificationsPopoverProps): React.JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const [notiList, setNotiList] = React.useState<Notification[]>([]);
|
||||
|
||||
const [loading, setLoading] = React.useState(false);
|
||||
const [error, setError] = React.useState<string | null>(null);
|
||||
|
||||
const { data, handleClose, handleOpen, open: testOpen } = useHelloworld<string>();
|
||||
React.useEffect(() => {
|
||||
setLoading(true);
|
||||
async function LoadAllNotifications() {
|
||||
const notiList: Notification[] = await getNotificationsByUserId('1');
|
||||
setNotiList(notiList);
|
||||
}
|
||||
setLoading(false);
|
||||
void LoadAllNotifications();
|
||||
}, []);
|
||||
|
||||
if (loading) return <>Loading</>;
|
||||
if (error) return <>Error</>;
|
||||
if (notiList.length == 0)
|
||||
return (
|
||||
<Popover
|
||||
anchorEl={anchorEl}
|
||||
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
|
||||
onClose={onClose}
|
||||
open={open}
|
||||
slotProps={{ paper: { sx: { width: '380px' } } }}
|
||||
transformOrigin={{ horizontal: 'right', vertical: 'top' }}
|
||||
>
|
||||
list is empty
|
||||
</Popover>
|
||||
);
|
||||
|
||||
return (
|
||||
<Popover
|
||||
anchorEl={anchorEl}
|
||||
@@ -84,24 +84,31 @@ export function NotificationsPopover({
|
||||
slotProps={{ paper: { sx: { width: '380px' } } }}
|
||||
transformOrigin={{ horizontal: 'right', vertical: 'top' }}
|
||||
>
|
||||
<Stack direction="row" spacing={2} sx={{ alignItems: 'center', justifyContent: 'space-between', px: 3, py: 2 }}>
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={2}
|
||||
sx={{ alignItems: 'center', justifyContent: 'space-between', px: 3, py: 2 }}
|
||||
>
|
||||
<Typography variant="h6">{t('Notifications')}</Typography>
|
||||
<Tooltip title={t('Mark all as read')}>
|
||||
<IconButton edge="end" onClick={onMarkAllAsRead}>
|
||||
<IconButton
|
||||
edge="end"
|
||||
onClick={onMarkAllAsRead}
|
||||
>
|
||||
<EnvelopeSimpleIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</Stack>
|
||||
{notifications.length === 0 ? (
|
||||
{notiList.length === 0 ? (
|
||||
<Box sx={{ p: 2 }}>
|
||||
<Typography variant="subtitle2">{t('There are no notifications')}</Typography>
|
||||
</Box>
|
||||
) : (
|
||||
<Box sx={{ maxHeight: '270px', overflowY: 'auto' }}>
|
||||
<List disablePadding>
|
||||
{notifications.map((notification, index) => (
|
||||
{notiList.map((notification, index) => (
|
||||
<NotificationItem
|
||||
divider={index < notifications.length - 1}
|
||||
divider={index < SampleNotifications.length - 1}
|
||||
key={notification.id}
|
||||
notification={notification}
|
||||
onRemove={() => {
|
||||
@@ -124,10 +131,17 @@ interface NotificationItemProps {
|
||||
|
||||
function NotificationItem({ divider, notification, onRemove }: NotificationItemProps): React.JSX.Element {
|
||||
return (
|
||||
<ListItem divider={divider} sx={{ alignItems: 'flex-start', justifyContent: 'space-between' }}>
|
||||
<ListItem
|
||||
divider={divider}
|
||||
sx={{ alignItems: 'flex-start', justifyContent: 'space-between' }}
|
||||
>
|
||||
<NotificationContent notification={notification} />
|
||||
<Tooltip title="Remove">
|
||||
<IconButton edge="end" onClick={onRemove} size="small">
|
||||
<IconButton
|
||||
edge="end"
|
||||
onClick={onRemove}
|
||||
size="small"
|
||||
>
|
||||
<XIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
@@ -142,14 +156,21 @@ interface NotificationContentProps {
|
||||
function NotificationContent({ notification }: NotificationContentProps): React.JSX.Element {
|
||||
if (notification.type === 'new_feature') {
|
||||
return (
|
||||
<Stack direction="row" spacing={2} sx={{ alignItems: 'flex-start' }}>
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={2}
|
||||
sx={{ alignItems: 'flex-start' }}
|
||||
>
|
||||
<Avatar>
|
||||
<ChatTextIcon fontSize="var(--Icon-fontSize)" />
|
||||
</Avatar>
|
||||
<div>
|
||||
<Typography variant="subtitle2">New feature!</Typography>
|
||||
<Typography variant="body2">{notification.description}</Typography>
|
||||
<Typography color="text.secondary" variant="caption">
|
||||
<Typography
|
||||
color="text.secondary"
|
||||
variant="caption"
|
||||
>
|
||||
{dayjs(notification.createdAt).format('MMM D, hh:mm A')}
|
||||
</Typography>
|
||||
</div>
|
||||
@@ -159,22 +180,35 @@ function NotificationContent({ notification }: NotificationContentProps): React.
|
||||
|
||||
if (notification.type === 'new_company') {
|
||||
return (
|
||||
<Stack direction="row" spacing={2} sx={{ alignItems: 'flex-start' }}>
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={2}
|
||||
sx={{ alignItems: 'flex-start' }}
|
||||
>
|
||||
<Avatar src={notification.author.avatar}>
|
||||
<UserIcon />
|
||||
</Avatar>
|
||||
<div>
|
||||
<Typography variant="body2">
|
||||
<Typography component="span" variant="subtitle2">
|
||||
<Typography
|
||||
component="span"
|
||||
variant="subtitle2"
|
||||
>
|
||||
{notification.author.name}
|
||||
</Typography>{' '}
|
||||
created{' '}
|
||||
<Link underline="always" variant="body2">
|
||||
<Link
|
||||
underline="always"
|
||||
variant="body2"
|
||||
>
|
||||
{notification.company.name}
|
||||
</Link>{' '}
|
||||
company
|
||||
</Typography>
|
||||
<Typography color="text.secondary" variant="caption">
|
||||
<Typography
|
||||
color="text.secondary"
|
||||
variant="caption"
|
||||
>
|
||||
{dayjs(notification.createdAt).format('MMM D, hh:mm A')}
|
||||
</Typography>
|
||||
</div>
|
||||
@@ -184,21 +218,34 @@ function NotificationContent({ notification }: NotificationContentProps): React.
|
||||
|
||||
if (notification.type === 'new_job') {
|
||||
return (
|
||||
<Stack direction="row" spacing={2} sx={{ alignItems: 'flex-start' }}>
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={2}
|
||||
sx={{ alignItems: 'flex-start' }}
|
||||
>
|
||||
<Avatar src={notification.author.avatar}>
|
||||
<UserIcon />
|
||||
</Avatar>
|
||||
<div>
|
||||
<Typography variant="body2">
|
||||
<Typography component="span" variant="subtitle2">
|
||||
<Typography
|
||||
component="span"
|
||||
variant="subtitle2"
|
||||
>
|
||||
{notification.author.name}
|
||||
</Typography>{' '}
|
||||
added a new job{' '}
|
||||
<Link underline="always" variant="body2">
|
||||
<Link
|
||||
underline="always"
|
||||
variant="body2"
|
||||
>
|
||||
{notification.job.title}
|
||||
</Link>
|
||||
</Typography>
|
||||
<Typography color="text.secondary" variant="caption">
|
||||
<Typography
|
||||
color="text.secondary"
|
||||
variant="caption"
|
||||
>
|
||||
{dayjs(notification.createdAt).format('MMM D, hh:mm A')}
|
||||
</Typography>
|
||||
</div>
|
@@ -0,0 +1,37 @@
|
||||
'use client';
|
||||
import { dayjs } from '@/lib/dayjs';
|
||||
import type { Notification } from './type.d.tsx.del';
|
||||
|
||||
export const SampleNotifications = [
|
||||
{
|
||||
id: 'EV-004',
|
||||
createdAt: dayjs().subtract(7, 'minute').subtract(5, 'hour').subtract(1, 'day').toDate(),
|
||||
read: false,
|
||||
type: 'new_job',
|
||||
author: { name: 'Jie Yan', avatar: '/assets/avatar-8.png' },
|
||||
job: { title: 'Remote React / React Native Developer' },
|
||||
},
|
||||
{
|
||||
id: 'EV-003',
|
||||
createdAt: dayjs().subtract(18, 'minute').subtract(3, 'hour').subtract(5, 'day').toDate(),
|
||||
read: true,
|
||||
type: 'new_job',
|
||||
author: { name: 'Fran Perez', avatar: '/assets/avatar-5.png' },
|
||||
job: { title: 'Senior Golang Backend Engineer' },
|
||||
},
|
||||
{
|
||||
id: 'EV-002',
|
||||
createdAt: dayjs().subtract(4, 'minute').subtract(5, 'hour').subtract(7, 'day').toDate(),
|
||||
read: true,
|
||||
type: 'new_feature',
|
||||
description: 'Logistics management is now available',
|
||||
},
|
||||
{
|
||||
id: 'EV-001',
|
||||
createdAt: dayjs().subtract(7, 'minute').subtract(8, 'hour').subtract(7, 'day').toDate(),
|
||||
read: true,
|
||||
type: 'new_company',
|
||||
author: { name: 'Jie Yan', avatar: '/assets/avatar-8.png' },
|
||||
company: { name: 'Stripe' },
|
||||
},
|
||||
] satisfies Notification[];
|
12
002_source/cms/src/components/dashboard/notification/type.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export interface NotificationFormProps {
|
||||
id?: string;
|
||||
title: string;
|
||||
message: string;
|
||||
isRead: boolean;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export interface NotificationItem extends NotificationFormProps {
|
||||
id: string;
|
||||
}
|
@@ -20,6 +20,7 @@ const COL_QUIZ_CR_QUESTIONS = 'QuizCRQuestions';
|
||||
|
||||
// ROLES:
|
||||
const COL_CUSTOMERS = 'Customers';
|
||||
const COL_NOTIFICATIONS = 'Notifications';
|
||||
const COL_TEACHERS = 'Teachers';
|
||||
const COL_STUDENTS = 'Students';
|
||||
|
||||
@@ -47,6 +48,7 @@ export {
|
||||
COL_QUIZ_CR_QUESTIONS,
|
||||
//
|
||||
COL_CUSTOMERS,
|
||||
COL_NOTIFICATIONS,
|
||||
COL_TEACHERS,
|
||||
COL_STUDENTS,
|
||||
//
|
||||
|
11
002_source/cms/src/db/Notifications/Create.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
// api method for create notification record
|
||||
// RULES:
|
||||
// TBA
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_NOTIFICATIONS } from '@/constants';
|
||||
import type { NotificationFormProps } from '@/components/dashboard/notification/type.d';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
export async function createNotification(data: NotificationFormProps): Promise<RecordModel> {
|
||||
return pb.collection(COL_NOTIFICATIONS).create(data);
|
||||
}
|
9
002_source/cms/src/db/Notifications/Delete.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
// api method for delete notification record
|
||||
// RULES:
|
||||
// TBA
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_NOTIFICATIONS } from '@/constants';
|
||||
|
||||
export async function deleteNotification(id: string): Promise<boolean> {
|
||||
return pb.collection(COL_NOTIFICATIONS).delete(id);
|
||||
}
|
9
002_source/cms/src/db/Notifications/GetActiveCount.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetActiveCount(): Promise<number> {
|
||||
const { totalItems: count } = await pb.collection(COL_CUSTOMERS).getList(1, 1, {
|
||||
filter: 'status = "active"',
|
||||
});
|
||||
return count;
|
||||
}
|
10
002_source/cms/src/db/Notifications/GetAll.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
// api method for get all notification records
|
||||
// RULES:
|
||||
// TBA
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_NOTIFICATIONS } from '@/constants';
|
||||
import { RecordModel } from 'pocketbase';
|
||||
|
||||
export async function getAllNotifications(options = {}): Promise<RecordModel[]> {
|
||||
return pb.collection(COL_NOTIFICATIONS).getFullList(options);
|
||||
}
|
7
002_source/cms/src/db/Notifications/GetAllCount.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
|
||||
export async function getAllCustomersCount(): Promise<number> {
|
||||
const result = await pb.collection(COL_CUSTOMERS).getList(1, 1);
|
||||
return result.totalItems;
|
||||
}
|
9
002_source/cms/src/db/Notifications/GetBlockedCount.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetBlockedCount(): Promise<number> {
|
||||
const { totalItems: count } = await pb.collection(COL_CUSTOMERS).getList(1, 1, {
|
||||
filter: 'status = "blocked"',
|
||||
});
|
||||
return count;
|
||||
}
|
10
002_source/cms/src/db/Notifications/GetById.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
// api method for get notification by id
|
||||
// RULES:
|
||||
// TBA
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_NOTIFICATIONS } from '@/constants';
|
||||
import { RecordModel } from 'pocketbase';
|
||||
|
||||
export async function getNotificationById(id: string): Promise<RecordModel> {
|
||||
return pb.collection(COL_NOTIFICATIONS).getOne(id);
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
// api method for get notifications by user id
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_NOTIFICATIONS } from '@/constants';
|
||||
import type { Notification } from './type.d';
|
||||
|
||||
export async function getNotificationsByUserId(userId: string): Promise<Notification[]> {
|
||||
const records = await pb.collection(COL_NOTIFICATIONS).getFullList({
|
||||
filter: `author.id = "000000000000001"`,
|
||||
sort: '-created',
|
||||
});
|
||||
return records as unknown as Notification[];
|
||||
}
|
9
002_source/cms/src/db/Notifications/GetPendingCount.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetPendingCount(): Promise<number> {
|
||||
const { totalItems: count } = await pb.collection(COL_CUSTOMERS).getList(1, 1, {
|
||||
filter: 'status = "pending"',
|
||||
});
|
||||
return count;
|
||||
}
|
3
002_source/cms/src/db/Notifications/Helloworld.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export function helloCustomer() {
|
||||
return 'Hello from Customers module!';
|
||||
}
|
11
002_source/cms/src/db/Notifications/Update.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
// api method for update notification record
|
||||
// RULES:
|
||||
// TBA
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_NOTIFICATIONS } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
import type { NotificationFormProps } from '@/components/dashboard/notification/type.d';
|
||||
|
||||
export async function updateNotification(id: string, data: Partial<NotificationFormProps>): Promise<RecordModel> {
|
||||
return pb.collection(COL_NOTIFICATIONS).update(id, data);
|
||||
}
|
31
002_source/cms/src/db/Notifications/_GUIDELINES.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `Customer`/`Customers` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx, GetActiveCount.tsx, GetBlockedCount.tsx, GetPendingCount.tsx)
|
||||
- misc (Helloworld.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Customers/type.d.tsx`
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
|
||||
export async function createCustomer(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection(xxx))
|
||||
}
|
||||
```
|
19
002_source/cms/src/db/Notifications/constants.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
// Default and empty values for Notification
|
||||
|
||||
import type { Notification } from './type';
|
||||
|
||||
export const defaultNotification: Notification = {
|
||||
id: '',
|
||||
read: false,
|
||||
type: '',
|
||||
author: {},
|
||||
job: {},
|
||||
description: '',
|
||||
NOTI_ID: '',
|
||||
created: '',
|
||||
updated: '',
|
||||
};
|
||||
|
||||
export const emptyNotification: Notification = {
|
||||
...defaultNotification,
|
||||
};
|
45
002_source/cms/src/db/Notifications/type.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use client';
|
||||
|
||||
export type SortDir = 'asc' | 'desc';
|
||||
|
||||
export interface Notification {
|
||||
id: string;
|
||||
read: boolean;
|
||||
type: string;
|
||||
author: Record<string, unknown>;
|
||||
job: Record<string, unknown>;
|
||||
description: string;
|
||||
NOTI_ID: string;
|
||||
created: string;
|
||||
updated: string;
|
||||
}
|
||||
|
||||
export interface CreateFormProps {
|
||||
read?: boolean;
|
||||
type: string;
|
||||
author: Record<string, unknown>;
|
||||
job: Record<string, unknown>;
|
||||
description: string;
|
||||
NOTI_ID: string;
|
||||
}
|
||||
|
||||
export interface EditFormProps {
|
||||
read?: boolean;
|
||||
type?: string;
|
||||
author?: Record<string, unknown>;
|
||||
job?: Record<string, unknown>;
|
||||
description?: string;
|
||||
NOTI_ID?: string;
|
||||
}
|
||||
|
||||
export interface NotificationsFiltersProps {
|
||||
filters?: Filters;
|
||||
sortDir?: SortDir;
|
||||
fullData: Notification[];
|
||||
}
|
||||
|
||||
export interface Filters {
|
||||
type?: string;
|
||||
read?: boolean;
|
||||
NOTI_ID?: string;
|
||||
}
|
@@ -982,6 +982,125 @@
|
||||
"indexes": [],
|
||||
"system": false
|
||||
},
|
||||
{
|
||||
"id": "pbc_977978967",
|
||||
"listRule": "",
|
||||
"viewRule": "",
|
||||
"createRule": "",
|
||||
"updateRule": "",
|
||||
"deleteRule": "",
|
||||
"name": "Notifications",
|
||||
"type": "base",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "bool2555855207",
|
||||
"name": "read",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text2363381545",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "type",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "json3182418120",
|
||||
"maxSize": 0,
|
||||
"name": "author",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "json4225294584",
|
||||
"maxSize": 0,
|
||||
"name": "job",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1843675174",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "description",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1798508311",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "NOTI_ID",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"system": false
|
||||
},
|
||||
{
|
||||
"id": "pbc_4061499106",
|
||||
"listRule": "",
|
||||
|
26
002_source/cms/src/hooks/use-helloworld.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import * as React from 'react';
|
||||
|
||||
interface DialogController<T> {
|
||||
data?: T;
|
||||
handleClose: () => void;
|
||||
handleOpen: (data?: T) => void;
|
||||
open: boolean;
|
||||
}
|
||||
|
||||
export function useHelloworld<T = unknown>(): DialogController<T> {
|
||||
const [state, setState] = React.useState<{ open: boolean; data?: T }>({ open: false, data: undefined });
|
||||
|
||||
const handleOpen = React.useCallback((data?: T) => {
|
||||
setState({ open: true, data });
|
||||
}, []);
|
||||
|
||||
const handleClose = React.useCallback(() => {
|
||||
setState({ open: false });
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
console.log('helloworld from useHelloworld');
|
||||
}, []);
|
||||
|
||||
return { data: state.data, handleClose, handleOpen, open: state.open };
|
||||
}
|
BIN
002_source/pocketbase/pb_hooks/assets/customer1.png
Normal file
After Width: | Height: | Size: 160 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/customer2.png
Normal file
After Width: | Height: | Size: 119 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/customer3.png
Normal file
After Width: | Height: | Size: 205 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/customer4.png
Normal file
After Width: | Height: | Size: 184 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/customer5.png
Normal file
After Width: | Height: | Size: 261 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/student1.png
Normal file
After Width: | Height: | Size: 160 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/student2.png
Normal file
After Width: | Height: | Size: 119 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/student3.png
Normal file
After Width: | Height: | Size: 205 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/student4.png
Normal file
After Width: | Height: | Size: 184 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/student5.png
Normal file
After Width: | Height: | Size: 261 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/teacher1.png
Normal file
After Width: | Height: | Size: 160 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/teacher2.png
Normal file
After Width: | Height: | Size: 119 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/teacher3.png
Normal file
After Width: | Height: | Size: 205 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/teacher4.png
Normal file
After Width: | Height: | Size: 184 KiB |
BIN
002_source/pocketbase/pb_hooks/assets/teacher5.png
Normal file
After Width: | Height: | Size: 261 KiB |
@@ -27,6 +27,14 @@ $app.rootCmd.addCommand(
|
||||
require(`${__hooks}/seed/031_QuizMFQuestions.js`)($app);
|
||||
//
|
||||
require(`${__hooks}/seed/040_QuizCRCategories.js`)($app);
|
||||
require(`${__hooks}/seed/041_QuizCRQuestions.js`)($app);
|
||||
//
|
||||
require(`${__hooks}/seed/050_Customers.js`)($app);
|
||||
require(`${__hooks}/seed/051_Teachers.js`)($app);
|
||||
require(`${__hooks}/seed/052_Students.js`)($app);
|
||||
//
|
||||
require(`${__hooks}/seed/060_Notifications.js`)($app);
|
||||
|
||||
|
||||
$app.reloadCachedCollections();
|
||||
$app.reloadSettings();
|
||||
|
@@ -33,7 +33,7 @@ module.exports = ($app) => {
|
||||
$app.save(record);
|
||||
}
|
||||
|
||||
console.log(`030_QuizCRCategories done`);
|
||||
console.log(`040_QuizCRCategories done`);
|
||||
};
|
||||
|
||||
const dirtyTruncateTable = (COLLECTION_NAME) => {
|
||||
|
187
002_source/pocketbase/pb_hooks/seed/041_QuizCRQuestions.js
Normal file
@@ -0,0 +1,187 @@
|
||||
module.exports = ($app) => {
|
||||
const ASSETS_DIR = "/pb_hooks/assets";
|
||||
const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name);
|
||||
const id_v = "1".padStart(15, 0); //id_vocabulary
|
||||
const id_c = "2".padStart(15, 0); //id_connectives
|
||||
const cat_id_technology = "3".padStart(15, 0);
|
||||
const getId = (id) => id.padStart(15, 0);
|
||||
let row_array = [
|
||||
[
|
||||
getId("1"),
|
||||
"news (CR)",
|
||||
getAsset("ci_news.jpg"),
|
||||
1,
|
||||
{},
|
||||
"visible",
|
||||
"news",
|
||||
getAsset("keyboard.mp3"),
|
||||
cat_id_technology,
|
||||
"question_fh_1",
|
||||
"question_sh_1",
|
||||
"modal_ans_1",
|
||||
cat_id_technology,
|
||||
{},
|
||||
],
|
||||
[
|
||||
getId("2"),
|
||||
"sports (CR)",
|
||||
getAsset("ci_sports.jpg"),
|
||||
2,
|
||||
{},
|
||||
"visible",
|
||||
"sports",
|
||||
getAsset("mouse.mp3"),
|
||||
cat_id_technology,
|
||||
"question_fh_2",
|
||||
"question_sh_2",
|
||||
"modal_ans_2",
|
||||
cat_id_technology,
|
||||
{},
|
||||
],
|
||||
[
|
||||
getId("3"),
|
||||
"technology (CR)",
|
||||
getAsset("ci_technology.jpg"),
|
||||
3,
|
||||
{},
|
||||
"visible",
|
||||
"technology",
|
||||
getAsset("keyboard.mp3"),
|
||||
cat_id_technology,
|
||||
"question_fh_3",
|
||||
"question_sh_3",
|
||||
"modal_ans_3",
|
||||
cat_id_technology,
|
||||
{},
|
||||
],
|
||||
[
|
||||
getId("4"),
|
||||
"art (CR)",
|
||||
getAsset("ci_art.jpg"),
|
||||
4,
|
||||
{},
|
||||
"visible",
|
||||
"art",
|
||||
getAsset("mouse.mp3"),
|
||||
cat_id_technology,
|
||||
"question_fh_4",
|
||||
"question_sh_4",
|
||||
"modal_ans_4",
|
||||
cat_id_technology,
|
||||
{},
|
||||
],
|
||||
[
|
||||
getId("5"),
|
||||
"basic (CR)",
|
||||
getAsset("ci_basic.jpg"),
|
||||
5,
|
||||
{},
|
||||
"visible",
|
||||
"basic",
|
||||
getAsset("keyboard.mp3"),
|
||||
cat_id_technology,
|
||||
"question_fh_5",
|
||||
"question_sh_5",
|
||||
"modal_ans_5",
|
||||
cat_id_technology,
|
||||
{},
|
||||
],
|
||||
[
|
||||
getId("6"),
|
||||
"nature (CR)",
|
||||
getAsset("ci_nature.jpg"),
|
||||
6,
|
||||
{},
|
||||
"visible",
|
||||
"nature",
|
||||
getAsset("keyboard.mp3"),
|
||||
cat_id_technology,
|
||||
"question_fh_6",
|
||||
"question_sh_6",
|
||||
"modal_ans_6",
|
||||
cat_id_technology,
|
||||
{},
|
||||
],
|
||||
[
|
||||
getId("7"),
|
||||
"workplace (CR)",
|
||||
getAsset("ci_workplace.jpg"),
|
||||
7,
|
||||
{},
|
||||
"visible",
|
||||
"workplace",
|
||||
getAsset("keyboard.mp3"),
|
||||
cat_id_technology,
|
||||
"question_fh_7",
|
||||
"question_sh_7",
|
||||
"modal_ans_7",
|
||||
cat_id_technology,
|
||||
{},
|
||||
],
|
||||
[
|
||||
getId("8"),
|
||||
"workplace (CR)",
|
||||
getAsset("ci_workplace.jpg"),
|
||||
8,
|
||||
{},
|
||||
"visible",
|
||||
"workplace",
|
||||
getAsset("keyboard.mp3"),
|
||||
cat_id_technology,
|
||||
"question_fh_8",
|
||||
"question_sh_8",
|
||||
"modal_ans_8",
|
||||
cat_id_technology,
|
||||
{},
|
||||
],
|
||||
[
|
||||
getId("99"),
|
||||
"test hidden (CR)",
|
||||
getAsset("ci_workplace.jpg"),
|
||||
9,
|
||||
{},
|
||||
"hidden",
|
||||
"test",
|
||||
getAsset("keyboard.mp3"),
|
||||
cat_id_technology,
|
||||
"question_fh_9",
|
||||
"question_sh_9",
|
||||
"modal_ans_9",
|
||||
cat_id_technology,
|
||||
{},
|
||||
],
|
||||
];
|
||||
dirtyTruncateTable("QuizCRQuestions");
|
||||
|
||||
let lt_collection = $app.findCollectionByNameOrId("QuizCRQuestions");
|
||||
|
||||
for (let i = 0; i < row_array.length; i++) {
|
||||
let lesson_type = row_array[i];
|
||||
|
||||
let record = new Record(lt_collection);
|
||||
record.set("id", lesson_type[0]);
|
||||
record.set("cat_name", lesson_type[1]);
|
||||
record.set("cat_image", lesson_type[2]);
|
||||
record.set("pos", lesson_type[3]);
|
||||
record.set("init_answer", lesson_type[4]);
|
||||
record.set("visible", lesson_type[5]);
|
||||
record.set("word", lesson_type[6]);
|
||||
record.set("sound", lesson_type[7]);
|
||||
record.set("cat_id", lesson_type[7]);
|
||||
record.set("question_fh", lesson_type[9]);
|
||||
record.set("question_sh", lesson_type[10]);
|
||||
record.set("modal_ans", lesson_type[11]);
|
||||
record.set("caf_id", lesson_type[12]);
|
||||
record.set("options", lesson_type[13]);
|
||||
|
||||
$app.save(record);
|
||||
}
|
||||
|
||||
console.log(`041_QuizCRQuestions done`);
|
||||
};
|
||||
|
||||
const dirtyTruncateTable = (COLLECTION_NAME) => {
|
||||
console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`);
|
||||
const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`);
|
||||
cmd_to_exec.output();
|
||||
};
|
152
002_source/pocketbase/pb_hooks/seed/050_Customers.js
Normal file
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// RULES: this is not a normal nodejs engine, it is a nodejs provided by golang, so fakerjs cannot be used here
|
||||
//
|
||||
module.exports = ($app) => {
|
||||
const ASSETS_DIR = "/pb_hooks/assets";
|
||||
const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name);
|
||||
const id_v = "1".padStart(15, 0); //id_vocabulary
|
||||
const id_c = "2".padStart(15, 0); //id_connectives
|
||||
const getId = (id) => id.padStart(15, 0);
|
||||
|
||||
// generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs`
|
||||
const SAMPLE_CUSTOMER_ARRAY = [
|
||||
[
|
||||
"000000000000001",
|
||||
"May",
|
||||
getAsset("customer1.png"),
|
||||
"June_Wintheiser33@hotmail.com",
|
||||
"281-378-5900 x822",
|
||||
"Green, Rempel and Hoeger",
|
||||
{
|
||||
country: "UK",
|
||||
state: "Arizona",
|
||||
city: "Winfieldburgh",
|
||||
zipCode: "92017-8004",
|
||||
line1: "1838 Willa Freeway",
|
||||
line2: "Suite 307",
|
||||
},
|
||||
98,
|
||||
"Asia/Urumqi",
|
||||
"fr",
|
||||
"USD",
|
||||
"active",
|
||||
],
|
||||
[
|
||||
"000000000000002",
|
||||
"Marilyne",
|
||||
getAsset("customer2.png"),
|
||||
"Carol_Blick@yahoo.com",
|
||||
"(893) 919-2445 x193",
|
||||
"White - Hessel",
|
||||
{
|
||||
country: "US",
|
||||
state: "Nevada",
|
||||
city: "Casa Grande",
|
||||
zipCode: "83831-3843",
|
||||
line1: "6984 Alberto Radial",
|
||||
line2: "Suite 154",
|
||||
},
|
||||
49,
|
||||
"Africa/Tunis",
|
||||
"es",
|
||||
"EUR",
|
||||
"pending",
|
||||
],
|
||||
[
|
||||
"000000000000003",
|
||||
"Jacklyn",
|
||||
getAsset("customer3.png"),
|
||||
"Tamara_Lynch11@yahoo.com",
|
||||
"597-593-0144 x168",
|
||||
"Rolfson LLC",
|
||||
{
|
||||
country: "CA",
|
||||
state: "Georgia",
|
||||
city: "New Brodyfort",
|
||||
zipCode: "18887-7075",
|
||||
line1: "493 Pfannerstill Meadow",
|
||||
line2: "Apt. 358",
|
||||
},
|
||||
44,
|
||||
"Asia/Manila",
|
||||
"en",
|
||||
"GBP",
|
||||
"blocked",
|
||||
],
|
||||
[
|
||||
"000000000000004",
|
||||
"Alana",
|
||||
getAsset("customer4.png"),
|
||||
"Ahmed_Willms@hotmail.com",
|
||||
"401.212.0386 x31125",
|
||||
"Friesen, Langworth and Thompson",
|
||||
{
|
||||
country: "UK",
|
||||
state: "North Carolina",
|
||||
city: "Fort Jerrell",
|
||||
zipCode: "14211",
|
||||
line1: "1763 West Street",
|
||||
line2: "Suite 699",
|
||||
},
|
||||
34,
|
||||
"America/Boa_Vista",
|
||||
"es",
|
||||
"USD",
|
||||
"active",
|
||||
],
|
||||
[
|
||||
"000000000000005",
|
||||
"Rocky",
|
||||
getAsset("customer5.png"),
|
||||
"Angela_Kuhic@gmail.com",
|
||||
"653.964.0412",
|
||||
"Hayes - Morar",
|
||||
{
|
||||
country: "US",
|
||||
state: "New York",
|
||||
city: "Kayton",
|
||||
zipCode: "82048-0645",
|
||||
line1: "636 Angel Junction",
|
||||
line2: "Apt. 361",
|
||||
},
|
||||
70,
|
||||
"America/Grand_Turk",
|
||||
"fr",
|
||||
"EUR",
|
||||
"pending",
|
||||
],
|
||||
];
|
||||
|
||||
let row_array = SAMPLE_CUSTOMER_ARRAY;
|
||||
dirtyTruncateTable("Customers");
|
||||
|
||||
let lt_collection = $app.findCollectionByNameOrId("Customers");
|
||||
|
||||
for (let i = 0; i < row_array.length; i++) {
|
||||
let customer = row_array[i];
|
||||
|
||||
let record = new Record(lt_collection);
|
||||
record.set("id", customer[0]);
|
||||
record.set("name", customer[1]);
|
||||
record.set("avatar_file", customer[2]);
|
||||
record.set("email", customer[3]);
|
||||
record.set("phone", customer[4]);
|
||||
record.set("company", customer[5]);
|
||||
record.set("billingAddress", customer[6]);
|
||||
record.set("taxId", customer[7]);
|
||||
record.set("timezone", customer[8]);
|
||||
record.set("language", customer[9]);
|
||||
record.set("currency", customer[10]);
|
||||
record.set("status", customer[11]);
|
||||
|
||||
$app.save(record);
|
||||
}
|
||||
|
||||
console.log(`050_Customers done`);
|
||||
};
|
||||
|
||||
const dirtyTruncateTable = (COLLECTION_NAME) => {
|
||||
console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`);
|
||||
const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`);
|
||||
cmd_to_exec.output();
|
||||
};
|
152
002_source/pocketbase/pb_hooks/seed/051_Teachers.js
Normal file
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// RULES: this is not a normal nodejs engine, it is a nodejs provided by golang, so fakerjs cannot be used here
|
||||
//
|
||||
module.exports = ($app) => {
|
||||
const ASSETS_DIR = "/pb_hooks/assets";
|
||||
const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name);
|
||||
const id_v = "1".padStart(15, 0); //id_vocabulary
|
||||
const id_c = "2".padStart(15, 0); //id_connectives
|
||||
const getId = (id) => id.padStart(15, 0);
|
||||
|
||||
// generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs`
|
||||
const TEACHER_ARRAY = [
|
||||
[
|
||||
getId("1"),
|
||||
"May",
|
||||
getAsset("teacher1.png"),
|
||||
"June_Wintheiser33@hotmail.com",
|
||||
"281-378-5900 x822",
|
||||
"Green, Rempel and Hoeger",
|
||||
{
|
||||
country: "UK",
|
||||
state: "Arizona",
|
||||
city: "Winfieldburgh",
|
||||
zipCode: "92017-8004",
|
||||
line1: "1838 Willa Freeway",
|
||||
line2: "Suite 307",
|
||||
},
|
||||
98,
|
||||
"Asia/Urumqi",
|
||||
"fr",
|
||||
"USD",
|
||||
"active",
|
||||
],
|
||||
[
|
||||
getId("2"),
|
||||
"Marilyne",
|
||||
getAsset("teacher2.png"),
|
||||
"Carol_Blick@yahoo.com",
|
||||
"(893) 919-2445 x193",
|
||||
"White - Hessel",
|
||||
{
|
||||
country: "US",
|
||||
state: "Nevada",
|
||||
city: "Casa Grande",
|
||||
zipCode: "83831-3843",
|
||||
line1: "6984 Alberto Radial",
|
||||
line2: "Suite 154",
|
||||
},
|
||||
49,
|
||||
"Africa/Tunis",
|
||||
"es",
|
||||
"EUR",
|
||||
"pending",
|
||||
],
|
||||
[
|
||||
getId("3"),
|
||||
"Jacklyn",
|
||||
getAsset("teacher3.png"),
|
||||
"Tamara_Lynch11@yahoo.com",
|
||||
"597-593-0144 x168",
|
||||
"Rolfson LLC",
|
||||
{
|
||||
country: "CA",
|
||||
state: "Georgia",
|
||||
city: "New Brodyfort",
|
||||
zipCode: "18887-7075",
|
||||
line1: "493 Pfannerstill Meadow",
|
||||
line2: "Apt. 358",
|
||||
},
|
||||
44,
|
||||
"Asia/Manila",
|
||||
"en",
|
||||
"GBP",
|
||||
"blocked",
|
||||
],
|
||||
[
|
||||
getId("4"),
|
||||
"Alana",
|
||||
getAsset("teacher4.png"),
|
||||
"Ahmed_Willms@hotmail.com",
|
||||
"401.212.0386 x31125",
|
||||
"Friesen, Langworth and Thompson",
|
||||
{
|
||||
country: "UK",
|
||||
state: "North Carolina",
|
||||
city: "Fort Jerrell",
|
||||
zipCode: "14211",
|
||||
line1: "1763 West Street",
|
||||
line2: "Suite 699",
|
||||
},
|
||||
34,
|
||||
"America/Boa_Vista",
|
||||
"es",
|
||||
"USD",
|
||||
"active",
|
||||
],
|
||||
[
|
||||
getId("5"),
|
||||
"Rocky",
|
||||
getAsset("teacher5.png"),
|
||||
"Angela_Kuhic@gmail.com",
|
||||
"653.964.0412",
|
||||
"Hayes - Morar",
|
||||
{
|
||||
country: "US",
|
||||
state: "New York",
|
||||
city: "Kayton",
|
||||
zipCode: "82048-0645",
|
||||
line1: "636 Angel Junction",
|
||||
line2: "Apt. 361",
|
||||
},
|
||||
70,
|
||||
"America/Grand_Turk",
|
||||
"fr",
|
||||
"EUR",
|
||||
"pending",
|
||||
],
|
||||
];
|
||||
|
||||
let row_array = TEACHER_ARRAY;
|
||||
dirtyTruncateTable("Teachers");
|
||||
|
||||
let lt_collection = $app.findCollectionByNameOrId("Teachers");
|
||||
|
||||
for (let i = 0; i < row_array.length; i++) {
|
||||
let teacher = row_array[i];
|
||||
|
||||
let record = new Record(lt_collection);
|
||||
record.set("id", teacher[0]);
|
||||
record.set("name", teacher[1]);
|
||||
record.set("avatar_file", teacher[2]);
|
||||
record.set("email", teacher[3]);
|
||||
record.set("phone", teacher[4]);
|
||||
record.set("company", teacher[5]);
|
||||
record.set("billingAddress", teacher[6]);
|
||||
record.set("taxId", teacher[7]);
|
||||
record.set("timezone", teacher[8]);
|
||||
record.set("language", teacher[9]);
|
||||
record.set("currency", teacher[10]);
|
||||
record.set("status", teacher[11]);
|
||||
|
||||
$app.save(record);
|
||||
}
|
||||
|
||||
console.log(`051_Teacher done`);
|
||||
};
|
||||
|
||||
const dirtyTruncateTable = (COLLECTION_NAME) => {
|
||||
console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`);
|
||||
const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`);
|
||||
cmd_to_exec.output();
|
||||
};
|
152
002_source/pocketbase/pb_hooks/seed/052_Students.js
Normal file
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// RULES: this is not a normal nodejs engine, it is a nodejs provided by golang, so fakerjs cannot be used here
|
||||
//
|
||||
module.exports = ($app) => {
|
||||
const ASSETS_DIR = "/pb_hooks/assets";
|
||||
const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name);
|
||||
const id_v = "1".padStart(15, 0); //id_vocabulary
|
||||
const id_c = "2".padStart(15, 0); //id_connectives
|
||||
const getId = (id) => id.padStart(15, 0);
|
||||
|
||||
// generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs`
|
||||
const STUDENT_ARRAY = [
|
||||
[
|
||||
getId("1"),
|
||||
"May",
|
||||
getAsset("student1.png"),
|
||||
"June_Wintheiser33@hotmail.com",
|
||||
"281-378-5900 x822",
|
||||
"Green, Rempel and Hoeger",
|
||||
{
|
||||
country: "UK",
|
||||
state: "Arizona",
|
||||
city: "Winfieldburgh",
|
||||
zipCode: "92017-8004",
|
||||
line1: "1838 Willa Freeway",
|
||||
line2: "Suite 307",
|
||||
},
|
||||
98,
|
||||
"Asia/Urumqi",
|
||||
"fr",
|
||||
"USD",
|
||||
"active",
|
||||
],
|
||||
[
|
||||
getId("2"),
|
||||
"Marilyne",
|
||||
getAsset("student2.png"),
|
||||
"Carol_Blick@yahoo.com",
|
||||
"(893) 919-2445 x193",
|
||||
"White - Hessel",
|
||||
{
|
||||
country: "US",
|
||||
state: "Nevada",
|
||||
city: "Casa Grande",
|
||||
zipCode: "83831-3843",
|
||||
line1: "6984 Alberto Radial",
|
||||
line2: "Suite 154",
|
||||
},
|
||||
49,
|
||||
"Africa/Tunis",
|
||||
"es",
|
||||
"EUR",
|
||||
"pending",
|
||||
],
|
||||
[
|
||||
getId("3"),
|
||||
"Jacklyn",
|
||||
getAsset("student3.png"),
|
||||
"Tamara_Lynch11@yahoo.com",
|
||||
"597-593-0144 x168",
|
||||
"Rolfson LLC",
|
||||
{
|
||||
country: "CA",
|
||||
state: "Georgia",
|
||||
city: "New Brodyfort",
|
||||
zipCode: "18887-7075",
|
||||
line1: "493 Pfannerstill Meadow",
|
||||
line2: "Apt. 358",
|
||||
},
|
||||
44,
|
||||
"Asia/Manila",
|
||||
"en",
|
||||
"GBP",
|
||||
"blocked",
|
||||
],
|
||||
[
|
||||
getId("4"),
|
||||
"Alana",
|
||||
getAsset("student4.png"),
|
||||
"Ahmed_Willms@hotmail.com",
|
||||
"401.212.0386 x31125",
|
||||
"Friesen, Langworth and Thompson",
|
||||
{
|
||||
country: "UK",
|
||||
state: "North Carolina",
|
||||
city: "Fort Jerrell",
|
||||
zipCode: "14211",
|
||||
line1: "1763 West Street",
|
||||
line2: "Suite 699",
|
||||
},
|
||||
34,
|
||||
"America/Boa_Vista",
|
||||
"es",
|
||||
"USD",
|
||||
"active",
|
||||
],
|
||||
[
|
||||
getId("5"),
|
||||
"Rocky",
|
||||
getAsset("student5.png"),
|
||||
"Angela_Kuhic@gmail.com",
|
||||
"653.964.0412",
|
||||
"Hayes - Morar",
|
||||
{
|
||||
country: "US",
|
||||
state: "New York",
|
||||
city: "Kayton",
|
||||
zipCode: "82048-0645",
|
||||
line1: "636 Angel Junction",
|
||||
line2: "Apt. 361",
|
||||
},
|
||||
70,
|
||||
"America/Grand_Turk",
|
||||
"fr",
|
||||
"EUR",
|
||||
"pending",
|
||||
],
|
||||
];
|
||||
|
||||
let row_array = STUDENT_ARRAY;
|
||||
dirtyTruncateTable("Students");
|
||||
|
||||
let lt_collection = $app.findCollectionByNameOrId("Students");
|
||||
|
||||
for (let i = 0; i < row_array.length; i++) {
|
||||
let student = row_array[i];
|
||||
|
||||
let record = new Record(lt_collection);
|
||||
record.set("id", student[0]);
|
||||
record.set("name", student[1]);
|
||||
record.set("avatar_file", student[2]);
|
||||
record.set("email", student[3]);
|
||||
record.set("phone", student[4]);
|
||||
record.set("company", student[5]);
|
||||
record.set("billingAddress", student[6]);
|
||||
record.set("taxId", student[7]);
|
||||
record.set("timezone", student[8]);
|
||||
record.set("language", student[9]);
|
||||
record.set("currency", student[10]);
|
||||
record.set("status", student[11]);
|
||||
|
||||
$app.save(record);
|
||||
}
|
||||
|
||||
console.log(`052_Students done`);
|
||||
};
|
||||
|
||||
const dirtyTruncateTable = (COLLECTION_NAME) => {
|
||||
console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`);
|
||||
const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`);
|
||||
cmd_to_exec.output();
|
||||
};
|
80
002_source/pocketbase/pb_hooks/seed/060_Notifications.js
Normal file
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// RULES: this is not a normal nodejs engine, it is a nodejs provided by golang, so fakerjs cannot be used here
|
||||
//
|
||||
module.exports = ($app) => {
|
||||
const ASSETS_DIR = "/pb_hooks/assets";
|
||||
const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name);
|
||||
const id_v = "1".padStart(15, 0); //id_vocabulary
|
||||
const id_c = "2".padStart(15, 0); //id_connectives
|
||||
const getId = (id) => id.padStart(15, 0);
|
||||
|
||||
// generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs`
|
||||
const SAMPLE_CUSTOMER_ARRAY = [
|
||||
[
|
||||
getId('1'),
|
||||
'EV-004',
|
||||
false,
|
||||
'new_job',
|
||||
{ "id":getId("1"),"name": 'Jie Yan', "avatar": '/assets/avatar-8.png' },
|
||||
{ "title": 'Remote React / React Native Developer' },
|
||||
""
|
||||
],
|
||||
[
|
||||
getId('2'),
|
||||
'EV-003',
|
||||
true,
|
||||
'new_job',
|
||||
{ "id": getId("2"),"name": 'Fran Perez', "avatar": '/assets/avatar-5.png' },
|
||||
{ "title": 'Senior Golang Backend Engineer' },
|
||||
""
|
||||
|
||||
],
|
||||
[
|
||||
getId('3'),
|
||||
'EV-002',
|
||||
true,
|
||||
'new_feature',
|
||||
'',
|
||||
'',
|
||||
'Logistics management is now available'
|
||||
],
|
||||
[
|
||||
getId('4'),
|
||||
'EV-001',
|
||||
true,
|
||||
'new_company',
|
||||
{"id":getId("3"), "name": 'Jie Yan', "avatar": '/assets/avatar-8.png' },
|
||||
{ "name": 'Stripe' },
|
||||
""
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
let row_array = SAMPLE_CUSTOMER_ARRAY;
|
||||
dirtyTruncateTable("Notifications");
|
||||
|
||||
let lt_collection = $app.findCollectionByNameOrId("Notifications");
|
||||
|
||||
for (let i = 0; i < row_array.length; i++) {
|
||||
let customer = row_array[i];
|
||||
|
||||
let record = new Record(lt_collection);
|
||||
record.set("id", customer[0]);
|
||||
record.set("NOTI_ID", customer[1]);
|
||||
record.set("read", customer[2]);
|
||||
record.set("type", customer[3]);
|
||||
record.set("author", customer[4]);
|
||||
record.set("job", customer[5]);
|
||||
record.set("description", customer[6]);
|
||||
|
||||
$app.save(record);
|
||||
}
|
||||
|
||||
console.log(`060_Notifications done`);
|
||||
};
|
||||
|
||||
const dirtyTruncateTable = (COLLECTION_NAME) => {
|
||||
console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`);
|
||||
const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`);
|
||||
cmd_to_exec.output();
|
||||
};
|
12
002_source/pocketbase/pb_hooks/seed/PARKING.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# task
|
||||
|
||||
i want you to draft `041_QuizCRQuestions.js`
|
||||
|
||||
## steps
|
||||
|
||||
1. read file `021_QuizLPQuestions.js`
|
||||
1. read file `031_QuizMFQuestions.js`
|
||||
1. read file `041_QuizCRQuestions.js`
|
||||
1. update the constants, variables and functions name in `041_QuizCRQuestions.js`
|
||||
|
||||
thanks
|
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_1305841361")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": "",
|
||||
"deleteRule": "",
|
||||
"listRule": "",
|
||||
"updateRule": "",
|
||||
"viewRule": ""
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_1305841361")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"listRule": null,
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,29 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3346420851")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(4, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text2058414169",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "visible",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3346420851")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text2058414169")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,48 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3346420851")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(7, new Field({
|
||||
"hidden": false,
|
||||
"id": "file4170105732",
|
||||
"maxSelect": 1,
|
||||
"maxSize": 0,
|
||||
"mimeTypes": [],
|
||||
"name": "sound",
|
||||
"presentable": false,
|
||||
"protected": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"thumbs": [],
|
||||
"type": "file"
|
||||
}))
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(8, new Field({
|
||||
"hidden": false,
|
||||
"id": "file2034676914",
|
||||
"maxSelect": 1,
|
||||
"maxSize": 0,
|
||||
"mimeTypes": [],
|
||||
"name": "cat_image",
|
||||
"presentable": false,
|
||||
"protected": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"thumbs": [],
|
||||
"type": "file"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3346420851")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("file4170105732")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("file2034676914")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,57 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_108570809",
|
||||
"indexes": [],
|
||||
"listRule": null,
|
||||
"name": "customers",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": "",
|
||||
"deleteRule": "",
|
||||
"listRule": "",
|
||||
"updateRule": "",
|
||||
"viewRule": ""
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"listRule": null,
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,122 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(1, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1579384326",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "name",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(2, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text3885137012",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "email",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(3, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1146066909",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "phone",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(4, new Field({
|
||||
"hidden": false,
|
||||
"id": "number1813778413",
|
||||
"max": null,
|
||||
"min": null,
|
||||
"name": "quota",
|
||||
"onlyInt": false,
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "number"
|
||||
}))
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(5, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text2063623452",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "status",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(6, new Field({
|
||||
"hidden": false,
|
||||
"id": "file507207115",
|
||||
"maxSelect": 1,
|
||||
"maxSize": 0,
|
||||
"mimeTypes": [],
|
||||
"name": "avatar_file",
|
||||
"presentable": false,
|
||||
"protected": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"thumbs": [],
|
||||
"type": "file"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text1579384326")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text3885137012")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text1146066909")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("number1813778413")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text2063623452")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("file507207115")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,20 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"name": "Customers"
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"name": "customers"
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(7, new Field({
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "_pb_users_auth_",
|
||||
"hidden": false,
|
||||
"id": "relation2809058197",
|
||||
"maxSelect": 1,
|
||||
"minSelect": 0,
|
||||
"name": "user_id",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("relation2809058197")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,141 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1400097126",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "country",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text2744374011",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "state",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text760939060",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "city",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text4114525948",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "zipCode",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text3620973610",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "line1",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1322974608",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "line2",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_1509025625",
|
||||
"indexes": [],
|
||||
"listRule": null,
|
||||
"name": "billingAddress",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_1509025625");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
@@ -0,0 +1,25 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(8, new Field({
|
||||
"hidden": false,
|
||||
"id": "json2115670734",
|
||||
"maxSize": 0,
|
||||
"name": "billingAddress",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("json2115670734")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,25 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("json2115670734")
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(8, new Field({
|
||||
"hidden": false,
|
||||
"id": "json2115670734",
|
||||
"maxSize": 0,
|
||||
"name": "billingAddress",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,25 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(8, new Field({
|
||||
"hidden": false,
|
||||
"id": "json2115670734",
|
||||
"maxSize": 0,
|
||||
"name": "billingAddress",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("json2115670734")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,29 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(9, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text922858135",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "timezone",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text922858135")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,48 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(10, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text3571151285",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "language",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(11, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1767278655",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "currency",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_108570809")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text3571151285")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text1767278655")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,204 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": "",
|
||||
"deleteRule": "",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1579384326",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "name",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text3885137012",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "email",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1146066909",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "phone",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "number1813778413",
|
||||
"max": null,
|
||||
"min": null,
|
||||
"name": "quota",
|
||||
"onlyInt": false,
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text2063623452",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "status",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "file507207115",
|
||||
"maxSelect": 1,
|
||||
"maxSize": 0,
|
||||
"mimeTypes": [],
|
||||
"name": "avatar_file",
|
||||
"presentable": false,
|
||||
"protected": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"thumbs": [],
|
||||
"type": "file"
|
||||
},
|
||||
{
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "_pb_users_auth_",
|
||||
"hidden": false,
|
||||
"id": "relation2809058197",
|
||||
"maxSelect": 1,
|
||||
"minSelect": 0,
|
||||
"name": "user_id",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "json2115670734",
|
||||
"maxSize": 0,
|
||||
"name": "billingAddress",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text922858135",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "timezone",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text3571151285",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "language",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1767278655",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "currency",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_1413424569",
|
||||
"indexes": [],
|
||||
"listRule": "",
|
||||
"name": "Teachers",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": "",
|
||||
"viewRule": ""
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_1413424569");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
@@ -0,0 +1,204 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": "",
|
||||
"deleteRule": "",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1579384326",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "name",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text3885137012",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "email",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1146066909",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "phone",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "number1813778413",
|
||||
"max": null,
|
||||
"min": null,
|
||||
"name": "quota",
|
||||
"onlyInt": false,
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text2063623452",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "status",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "file507207115",
|
||||
"maxSelect": 1,
|
||||
"maxSize": 0,
|
||||
"mimeTypes": [],
|
||||
"name": "avatar_file",
|
||||
"presentable": false,
|
||||
"protected": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"thumbs": [],
|
||||
"type": "file"
|
||||
},
|
||||
{
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "_pb_users_auth_",
|
||||
"hidden": false,
|
||||
"id": "relation2809058197",
|
||||
"maxSelect": 1,
|
||||
"minSelect": 0,
|
||||
"name": "user_id",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "json2115670734",
|
||||
"maxSize": 0,
|
||||
"name": "billingAddress",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text922858135",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "timezone",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text3571151285",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "language",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1767278655",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "currency",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_491894781",
|
||||
"indexes": [],
|
||||
"listRule": "",
|
||||
"name": "Students",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": "",
|
||||
"viewRule": ""
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_491894781");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
@@ -0,0 +1,100 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "bool2555855207",
|
||||
"name": "read",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text2363381545",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "type",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "json3182418120",
|
||||
"maxSize": 0,
|
||||
"name": "author",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "json4225294584",
|
||||
"maxSize": 0,
|
||||
"name": "job",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_977978967",
|
||||
"indexes": [],
|
||||
"listRule": null,
|
||||
"name": "Notifications",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_977978967");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
@@ -0,0 +1,29 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_977978967")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(5, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1843675174",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "description",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_977978967")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text1843675174")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,29 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_977978967")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(6, new Field({
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1798508311",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "NOTI_ID",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_977978967")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("text1798508311")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_977978967")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": "",
|
||||
"deleteRule": "",
|
||||
"listRule": "",
|
||||
"updateRule": "",
|
||||
"viewRule": ""
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_977978967")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"listRule": null,
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
})
|