Merge branch 'dev' into feat/um-76-turn-off-ui

This commit is contained in:
Brian Cao 2022-10-26 22:39:39 -07:00
commit 736f06442c
12 changed files with 850 additions and 36 deletions

View File

@ -78,7 +78,7 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
const [message, setMessage] = useState();
const handleSubmit = async values => {
const { id: websiteId } = values;
const { websiteUuid: websiteId } = values;
const { ok, data } = await post(websiteId ? `/websites/${websiteId}` : '/websites', values);

View File

@ -24,7 +24,7 @@ export default function DashboardEdit({ websites }) {
const ordered = useMemo(
() =>
websites
.map(website => ({ ...website, order: order.indexOf(website.websiteId) }))
.map(website => ({ ...website, order: order.indexOf(website.websiteUuid) }))
.sort(firstBy('order')),
[websites, order],
);
@ -36,7 +36,7 @@ export default function DashboardEdit({ websites }) {
const [removed] = orderedWebsites.splice(source.index, 1);
orderedWebsites.splice(destination.index, 0, removed);
setOrder(orderedWebsites.map(website => website?.websiteId || 0));
setOrder(orderedWebsites.map(website => website?.websiteUuid || 0));
}
function handleSave() {
@ -76,8 +76,12 @@ export default function DashboardEdit({ websites }) {
ref={provided.innerRef}
style={{ marginBottom: snapshot.isDraggingOver ? 260 : null }}
>
{ordered.map(({ websiteId, name, domain }, index) => (
<Draggable key={websiteId} draggableId={`${dragId}-${websiteId}`} index={index}>
{ordered.map(({ websiteUuid, name, domain }, index) => (
<Draggable
key={websiteUuid}
draggableId={`${dragId}-${websiteUuid}`}
index={index}
>
{(provided, snapshot) => (
<div
ref={provided.innerRef}

View File

@ -1,2 +1,5 @@
[functions]
included_files = ["node_modules/.geo/**"]
[[plugins]]
package = "@netlify/plugin-nextjs"

View File

@ -106,6 +106,7 @@
},
"devDependencies": {
"@formatjs/cli": "^4.2.29",
"@netlify/plugin-nextjs": "^4.27.3",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-replace": "^4.0.0",
"@svgr/webpack": "^6.2.1",

View File

@ -25,7 +25,7 @@ export default async (req, res) => {
const websites =
isAdmin && include_all
? await getAllWebsites()
: await getUserWebsites({ userId: account.id });
: await getUserWebsites({ userId: account?.id });
return ok(res, websites);
}

View File

@ -39,7 +39,7 @@ export async function deleteAccount(userId) {
}),
])
.then(async res => {
if (redis.client) {
if (redis.enabled) {
for (let i = 0; i < websiteUuids.length; i++) {
await redis.set(`website:${websiteUuids[i]}`, DELETED);
}

View File

@ -14,8 +14,8 @@ export async function createWebsite(userId, data) {
},
})
.then(async res => {
if (redis.client && res) {
await redis.client.set(`website:${res.websiteUuid}`, res.id);
if (redis.enabled && res) {
await redis.set(`website:${res.websiteUuid}`, res.id);
}
return res;

View File

@ -21,8 +21,8 @@ export async function deleteWebsite(websiteUuid) {
where: { websiteUuid },
}),
]).then(async res => {
if (redis.client) {
await redis.client.set(`website:${websiteUuid}`, DELETED);
if (redis.enabled) {
await redis.set(`website:${websiteUuid}`, DELETED);
}
return res;

View File

@ -8,7 +8,7 @@ export async function getWebsite(where) {
})
.then(async data => {
if (redis.enabled && data) {
await redis.client.set(`website:${data.websiteUuid}`, data.id);
await redis.set(`website:${data.websiteUuid}`, data.id);
}
return data;

View File

@ -30,8 +30,8 @@ async function relationalQuery(websiteId, data) {
},
})
.then(async res => {
if (redis.client && res) {
await redis.client.set(`session:${res.sessionUuid}`, 1);
if (redis.enabled && res) {
await redis.set(`session:${res.sessionUuid}`, 1);
}
return res;
@ -59,7 +59,7 @@ async function clickhouseQuery(
await sendMessage(params, 'event');
if (redis.client) {
await redis.client.set(`session:${sessionUuid}`, 1);
if (redis.enabled) {
await redis.set(`session:${sessionUuid}`, 1);
}
}

View File

@ -18,8 +18,8 @@ async function relationalQuery(sessionUuid) {
},
})
.then(async res => {
if (redis.client && res) {
await redis.client.set(`session:${res.sessionUuid}`, 1);
if (redis.enabled && res) {
await redis.set(`session:${res.sessionUuid}`, 1);
}
return res;
@ -48,8 +48,8 @@ async function clickhouseQuery(sessionUuid) {
)
.then(result => findFirst(result))
.then(async res => {
if (redis.client && res) {
await redis.client.set(`session:${res.session_uuid}`, 1);
if (redis.enabled && res) {
await redis.set(`session:${res.session_uuid}`, 1);
}
return res;

838
yarn.lock

File diff suppressed because it is too large Load Diff