fix: undefined org name in student invite link + community error (#101)
* fix: move org slot media query to postcss * fix: remove slot css * fix: remove unused vars * fix: a ton of community improvements * chore: ci/cd supabase
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
name: Deploy Supabase on Push
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
SUPABASE_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
SUPABASE_DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||||
|
PROJECT_ID: tapaozmyjsuykgerrfkt
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: supabase/setup-cli@v1
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
- run: supabase link --project-ref $PROJECT_ID
|
||||||
|
- run: supabase db push
|
||||||
@@ -127,6 +127,14 @@ code {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 457px) {
|
||||||
|
.org-slot {
|
||||||
|
min-width: 100%;
|
||||||
|
max-height: calc(100vh - 48px);
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@tailwind components;
|
@tailwind components;
|
||||||
|
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|||||||
+10
-2
@@ -6,11 +6,19 @@
|
|||||||
export let onDelete = () => {};
|
export let onDelete = () => {};
|
||||||
export let onCancel = () => {};
|
export let onCancel = () => {};
|
||||||
export let open = false;
|
export let open = false;
|
||||||
|
export let isQuestion = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal onClose={() => (open = false)} bind:open width="w-96" modalHeading="Delete comment">
|
<Modal
|
||||||
|
onClose={() => (open = false)}
|
||||||
|
bind:open
|
||||||
|
width="w-96"
|
||||||
|
modalHeading="Delete {isQuestion ? 'question' : 'comment'}"
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<h1 class="dark:text-white text-lg">Are you sure you want to delete this comment?</h1>
|
<h1 class="dark:text-white text-lg">
|
||||||
|
Are you sure you want to delete this {isQuestion ? 'question' : 'comment'}?
|
||||||
|
</h1>
|
||||||
|
|
||||||
<div class="mt-5 flex items-center justify-between">
|
<div class="mt-5 flex items-center justify-between">
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import AddCommentIcon from 'carbon-icons-svelte/lib/AddComment.svelte';
|
import AddCommentIcon from 'carbon-icons-svelte/lib/AddComment.svelte';
|
||||||
import CommunityLoader from './Loader.svelte';
|
import CommunityLoader from './Loader.svelte';
|
||||||
@@ -15,10 +15,9 @@
|
|||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let discussions = [];
|
let discussions = [];
|
||||||
|
|
||||||
async function fetchCommunityQuestions(orgId) {
|
async function fetchCommunityQuestions(orgId?: string) {
|
||||||
if (!orgId) return;
|
if (!orgId) return;
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
|
||||||
const { data, error } = await supabase
|
const { data, error } = await supabase
|
||||||
.from('community_question')
|
.from('community_question')
|
||||||
.select(
|
.select(
|
||||||
@@ -29,12 +28,13 @@
|
|||||||
created_at,
|
created_at,
|
||||||
slug,
|
slug,
|
||||||
comments:community_answer(count),
|
comments:community_answer(count),
|
||||||
author:organizationmember!community_question_author_id_fkey!inner(
|
author:profile(
|
||||||
profile!inner(fullname)
|
fullname
|
||||||
)
|
)
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.eq('organization_id', orgId);
|
.eq('organization_id', orgId)
|
||||||
|
.order('created_at', { ascending: false });
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
console.log('error', error);
|
console.log('error', error);
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
data?.map((discussion) => ({
|
data?.map((discussion) => ({
|
||||||
title: discussion.title,
|
title: discussion.title,
|
||||||
slug: discussion.slug,
|
slug: discussion.slug,
|
||||||
author: discussion?.author?.profile?.fullname,
|
author: discussion?.author?.fullname,
|
||||||
comments: discussion.comments?.[0]?.count || 0,
|
comments: discussion.comments?.[0]?.count || 0,
|
||||||
votes: discussion.votes,
|
votes: discussion.votes,
|
||||||
createdAt: calDateDiff(discussion.created_at)
|
createdAt: calDateDiff(discussion.created_at)
|
||||||
|
|||||||
@@ -15,12 +15,10 @@
|
|||||||
import OrgLandingPage from '$lib/components/Org/LandingPage/index.svelte';
|
import OrgLandingPage from '$lib/components/Org/LandingPage/index.svelte';
|
||||||
import Snackbar from '$lib/components/Snackbar/index.svelte';
|
import Snackbar from '$lib/components/Snackbar/index.svelte';
|
||||||
import Backdrop from '$lib/components/Backdrop/index.svelte';
|
import Backdrop from '$lib/components/Backdrop/index.svelte';
|
||||||
import OrgSideBar from '$lib/components/Org/SideBar.svelte';
|
|
||||||
import LMSSideBar from '$lib/components/LMS/SideBar.svelte';
|
|
||||||
import Apps from '$lib/components/Apps/index.svelte';
|
import Apps from '$lib/components/Apps/index.svelte';
|
||||||
import PlayQuiz from '$lib/components/Org/Quiz/Play/index.svelte';
|
import PlayQuiz from '$lib/components/Org/Quiz/Play/index.svelte';
|
||||||
import { course } from '$lib/components/Course/store';
|
import { course } from '$lib/components/Course/store';
|
||||||
import { isCoursesPage, isOrgPage, isLMSPage, isQuizPage } from '$lib/utils/functions/app';
|
import { isCoursesPage, isOrgPage, isLMSPage } from '$lib/utils/functions/app';
|
||||||
import showAppsSideBar from '$lib/utils/functions/showAppsSideBar';
|
import showAppsSideBar from '$lib/utils/functions/showAppsSideBar';
|
||||||
import isPublicRoute from '$lib/utils/functions/routes/isPublicRoute';
|
import isPublicRoute from '$lib/utils/functions/routes/isPublicRoute';
|
||||||
import { user, profile } from '$lib/utils/store/user';
|
import { user, profile } from '$lib/utils/store/user';
|
||||||
@@ -34,7 +32,6 @@
|
|||||||
import { setTheme } from '$lib/utils/functions/theme';
|
import { setTheme } from '$lib/utils/functions/theme';
|
||||||
import hideNavByRoute from '$lib/utils/functions/routes/hideNavByRoute';
|
import hideNavByRoute from '$lib/utils/functions/routes/hideNavByRoute';
|
||||||
import shouldRedirectOnAuth from '$lib/utils/functions/routes/shouldRedirectOnAuth';
|
import shouldRedirectOnAuth from '$lib/utils/functions/routes/shouldRedirectOnAuth';
|
||||||
import AddOrgModal from '$lib/components/Org/AddOrgModal/AddOrgModal.svelte';
|
|
||||||
import { identifyPosthogUser, initPosthog } from '$lib/utils/services/posthog';
|
import { identifyPosthogUser, initPosthog } from '$lib/utils/services/posthog';
|
||||||
import { initSentry, setSentryUser } from '$lib/utils/services/sentry';
|
import { initSentry, setSentryUser } from '$lib/utils/services/sentry';
|
||||||
|
|
||||||
@@ -412,11 +409,4 @@
|
|||||||
row-gap: 12px;
|
row-gap: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 457px) {
|
|
||||||
.org-slot {
|
|
||||||
min-width: 100%;
|
|
||||||
max-height: calc(100vh - 48px);
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import Community from '$lib/components/Org/Community/index.svelte';
|
import Community from '$lib/components/Org/Community/index.svelte';
|
||||||
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
||||||
import { currentOrgPath } from '$lib/utils/store/org';
|
|
||||||
|
|
||||||
function askCommunity() {
|
function askCommunity() {
|
||||||
goto(`${$currentOrgPath}/community/ask`);
|
goto(`/lms/community/ask`);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import pluralize from 'pluralize';
|
import pluralize from 'pluralize';
|
||||||
import TrashCanIcon from 'carbon-icons-svelte/lib/TrashCan.svelte';
|
import TrashCanIcon from 'carbon-icons-svelte/lib/TrashCan.svelte';
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
import Avatar from '$lib/components/Avatar/index.svelte';
|
import Avatar from '$lib/components/Avatar/index.svelte';
|
||||||
import IconButton from '$lib/components/IconButton/index.svelte';
|
import IconButton from '$lib/components/IconButton/index.svelte';
|
||||||
import CheckmarkOutlineIcon from 'carbon-icons-svelte/lib/CheckmarkOutline.svelte';
|
import CheckmarkOutlineIcon from 'carbon-icons-svelte/lib/CheckmarkOutline.svelte';
|
||||||
import { currentOrg } from '$lib/utils/store/org';
|
import { isOrgAdmin } from '$lib/utils/store/org';
|
||||||
import { profile } from '$lib/utils/store/user';
|
import { profile } from '$lib/utils/store/user';
|
||||||
import { supabase } from '$lib/utils/functions/supabase';
|
import { supabase } from '$lib/utils/functions/supabase';
|
||||||
import {
|
import {
|
||||||
@@ -19,23 +19,59 @@
|
|||||||
} from '$lib/utils/functions/validator';
|
} from '$lib/utils/functions/validator';
|
||||||
import { snackbar } from '$lib/components/Snackbar/store';
|
import { snackbar } from '$lib/components/Snackbar/store';
|
||||||
import TextField from '$lib/components/Form/TextField.svelte';
|
import TextField from '$lib/components/Form/TextField.svelte';
|
||||||
import DeleteCommentModal from '$lib/components/Org/Community/DeleteCommentModal.svelte';
|
import DeleteModal from '$lib/components/Org/Community/DeleteModal.svelte';
|
||||||
import TextEditor from '$lib/components/TextEditor/index.svelte';
|
import TextEditor from '$lib/components/TextEditor/index.svelte';
|
||||||
import { calDateDiff } from '$lib/utils/functions/date';
|
import { calDateDiff } from '$lib/utils/functions/date';
|
||||||
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
const { slug } = data;
|
const { slug } = data;
|
||||||
|
|
||||||
let question;
|
interface Comment {
|
||||||
|
id: string;
|
||||||
|
authorId: string;
|
||||||
|
name: string;
|
||||||
|
avatar: string;
|
||||||
|
votes: number;
|
||||||
|
comment: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
|
interface Question {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
votes: number;
|
||||||
|
author: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
avatar: string;
|
||||||
|
};
|
||||||
|
body: string;
|
||||||
|
createdAt: string;
|
||||||
|
comments: Comment[];
|
||||||
|
totalComments: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
let question: Question;
|
||||||
let comment = '';
|
let comment = '';
|
||||||
let errors = {};
|
let errors: {
|
||||||
|
title?: string;
|
||||||
|
} = {};
|
||||||
let isValidAnswer = false; // V2 allow admin mark an answer as accepted
|
let isValidAnswer = false; // V2 allow admin mark an answer as accepted
|
||||||
let resetInput = 1;
|
let resetInput = 1;
|
||||||
let voted = { question: false, comment: {} };
|
let voted: {
|
||||||
|
question: boolean;
|
||||||
|
comment: {
|
||||||
|
[key: string]: boolean;
|
||||||
|
};
|
||||||
|
} = { question: false, comment: {} };
|
||||||
let isEditMode = false;
|
let isEditMode = false;
|
||||||
let deleteComment = {
|
let deleteComment = {
|
||||||
shouldDelete: false,
|
shouldDelete: false,
|
||||||
commentId: null
|
commentId: ''
|
||||||
|
};
|
||||||
|
let deleteQuestion = {
|
||||||
|
shouldDelete: false,
|
||||||
|
questionId: ''
|
||||||
};
|
};
|
||||||
let editContent = {
|
let editContent = {
|
||||||
title: '',
|
title: '',
|
||||||
@@ -44,23 +80,23 @@
|
|||||||
|
|
||||||
let editorInstance = false;
|
let editorInstance = false;
|
||||||
|
|
||||||
function mapResToQuestion(data) {
|
function mapResToQuestion(data): Question {
|
||||||
return {
|
return {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
votes: data.votes,
|
votes: data.votes,
|
||||||
author: {
|
author: {
|
||||||
id: data?.author?.profile?.id || '',
|
id: data?.author?.id || '',
|
||||||
name: data?.author?.profile?.fullname || '',
|
name: data?.author?.fullname || '',
|
||||||
avatar: data?.author?.profile?.avatar_url || ''
|
avatar: data?.author?.avatar_url || ''
|
||||||
},
|
},
|
||||||
body: data.body,
|
body: data.body,
|
||||||
createdAt: calDateDiff(data.created_at),
|
createdAt: calDateDiff(data.created_at),
|
||||||
comments: data.comments.map((c) => ({
|
comments: data.comments.map((c) => ({
|
||||||
id: c.id,
|
id: c.id,
|
||||||
authorId: c.author?.profile?.id || '',
|
authorId: c.author?.id || '',
|
||||||
name: c.author?.profile?.fullname || '',
|
name: c.author?.fullname || '',
|
||||||
avatar: c.author?.profile?.avatar_url || '',
|
avatar: c.author?.avatar_url || '',
|
||||||
votes: c.votes,
|
votes: c.votes,
|
||||||
comment: c.body,
|
comment: c.body,
|
||||||
createdAt: calDateDiff(c.created_at)
|
createdAt: calDateDiff(c.created_at)
|
||||||
@@ -69,7 +105,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchCommunityQuestion(slug) {
|
async function fetchCommunityQuestion(slug: string) {
|
||||||
if (!slug) return;
|
if (!slug) return;
|
||||||
|
|
||||||
const { data, error } = await supabase
|
const { data, error } = await supabase
|
||||||
@@ -81,26 +117,23 @@
|
|||||||
body,
|
body,
|
||||||
votes,
|
votes,
|
||||||
created_at,
|
created_at,
|
||||||
|
slug,
|
||||||
comments:community_answer(
|
comments:community_answer(
|
||||||
id,
|
id,
|
||||||
body,
|
body,
|
||||||
votes,
|
votes,
|
||||||
created_at,
|
created_at,
|
||||||
author:organizationmember!community_answer_author_id_fkey!inner(
|
author:profile(id, fullname, avatar_url)
|
||||||
profile!inner(id, fullname, avatar_url)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
author:organizationmember!community_question_author_id_fkey!inner(
|
author:profile(id, fullname, avatar_url)
|
||||||
profile!inner(id, fullname, avatar_url)
|
|
||||||
)
|
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.eq('slug', slug)
|
.eq('slug', slug)
|
||||||
.single();
|
.single();
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('Error loading community', error);
|
console.error('[LMS] Error loading community', error);
|
||||||
return goto('/lms/community');
|
return goto(`/lms`);
|
||||||
}
|
}
|
||||||
|
|
||||||
question = mapResToQuestion(data);
|
question = mapResToQuestion(data);
|
||||||
@@ -121,7 +154,7 @@
|
|||||||
id: undefined,
|
id: undefined,
|
||||||
body: comment,
|
body: comment,
|
||||||
question_id: question.id,
|
question_id: question.id,
|
||||||
author_id: $currentOrg.memberId,
|
author_profile_id: $profile.id,
|
||||||
votes: 0
|
votes: 0
|
||||||
})
|
})
|
||||||
.select();
|
.select();
|
||||||
@@ -132,7 +165,7 @@
|
|||||||
} else {
|
} else {
|
||||||
console.log('Success: commenting', data);
|
console.log('Success: commenting', data);
|
||||||
|
|
||||||
snackbar.success();
|
snackbar.success('Comment Submitted!');
|
||||||
|
|
||||||
// Add to comment
|
// Add to comment
|
||||||
const _c = data?.[0];
|
const _c = data?.[0];
|
||||||
@@ -140,6 +173,7 @@
|
|||||||
...question.comments,
|
...question.comments,
|
||||||
{
|
{
|
||||||
id: _c.id,
|
id: _c.id,
|
||||||
|
authorId: $profile.id || '',
|
||||||
name: $profile?.fullname || '',
|
name: $profile?.fullname || '',
|
||||||
avatar: $profile?.avatar_url || '',
|
avatar: $profile?.avatar_url || '',
|
||||||
votes: 0,
|
votes: 0,
|
||||||
@@ -154,11 +188,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function upvoteQuestion(type, commentId) {
|
async function upvoteQuestion(type: string, commentId?: string) {
|
||||||
const isQuestion = type === 'question';
|
const isQuestion = type === 'question';
|
||||||
|
|
||||||
if (isQuestion && voted.question) return;
|
if (isQuestion && voted.question) return;
|
||||||
if (!isQuestion && voted.comment[commentId]) return;
|
if (!isQuestion && commentId && voted.comment[commentId]) return;
|
||||||
|
|
||||||
const table = isQuestion ? 'community_question' : 'community_answer';
|
const table = isQuestion ? 'community_question' : 'community_answer';
|
||||||
const matchId = isQuestion ? question.id : commentId;
|
const matchId = isQuestion ? question.id : commentId;
|
||||||
@@ -179,11 +213,11 @@
|
|||||||
const { error } = await supabase.from(table).update({ votes }).match({ id: matchId });
|
const { error } = await supabase.from(table).update({ votes }).match({ id: matchId });
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('Error: upvoteQuestion', error);
|
console.error('Error: upvoteQuestion', error);
|
||||||
snackbar.error();
|
snackbar.error('Error - Please try again later');
|
||||||
} else {
|
} else {
|
||||||
if (isQuestion) {
|
if (isQuestion) {
|
||||||
voted.question = true;
|
voted.question = true;
|
||||||
} else {
|
} else if (commentId) {
|
||||||
voted.comment[commentId] = true;
|
voted.comment[commentId] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,7 +251,7 @@
|
|||||||
.match({ id: question.id });
|
.match({ id: question.id });
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('Error: handleQuestionEdit', error);
|
console.error('Error: handleQuestionEdit', error);
|
||||||
snackbar.error();
|
snackbar.error('Error - Please try again later');
|
||||||
} else {
|
} else {
|
||||||
question.title = fields.title;
|
question.title = fields.title;
|
||||||
question.body = fields.body;
|
question.body = fields.body;
|
||||||
@@ -231,34 +265,78 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleCommentDelete() {
|
async function handleDelete(isQuestion: boolean) {
|
||||||
const { error } = await supabase
|
if (!isQuestion) {
|
||||||
|
const { error } = await supabase
|
||||||
|
.from('community_answer')
|
||||||
|
.delete()
|
||||||
|
.match({ id: deleteComment.commentId });
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
snackbar.error('Error deleting comments');
|
||||||
|
console.log('Error deleting comments', error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
snackbar.success('Deleted successfully');
|
||||||
|
|
||||||
|
question.comments = question.comments.filter((c) => c.id !== deleteComment.commentId);
|
||||||
|
deleteComment.shouldDelete = false;
|
||||||
|
deleteComment.commentId = '';
|
||||||
|
|
||||||
|
// Handle only delete comment
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { error: commentDeleteError } = await supabase
|
||||||
.from('community_answer')
|
.from('community_answer')
|
||||||
.delete()
|
.delete()
|
||||||
.match({ id: deleteComment.commentId });
|
.match({ question_id: deleteQuestion.questionId });
|
||||||
|
|
||||||
if (!error) {
|
if (commentDeleteError) {
|
||||||
question.comments = question.comments.filter((c) => c.id !== deleteComment.commentId);
|
snackbar.error('Error deleting comments');
|
||||||
|
console.log('Error deleting comments', commentDeleteError);
|
||||||
deleteComment.shouldDelete = false;
|
return;
|
||||||
deleteComment.commentId = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { error: questionDeleteError } = await supabase
|
||||||
|
.from('community_question')
|
||||||
|
.delete()
|
||||||
|
.match({ id: deleteQuestion.questionId });
|
||||||
|
|
||||||
|
if (questionDeleteError) {
|
||||||
|
snackbar.error('Error deleting question');
|
||||||
|
console.log('Error deleting question', questionDeleteError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
snackbar.success('Deleted successfully');
|
||||||
|
goto(`/lms/community`);
|
||||||
}
|
}
|
||||||
|
|
||||||
$: fetchCommunityQuestion(slug);
|
$: browser && fetchCommunityQuestion(slug);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>{question?.title || 'Question'}</title>
|
<title>{question?.title || 'Question'}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<DeleteCommentModal
|
<DeleteModal
|
||||||
|
bind:open={deleteQuestion.shouldDelete}
|
||||||
|
onCancel={() => {
|
||||||
|
deleteQuestion.shouldDelete = false;
|
||||||
|
deleteQuestion.questionId = '';
|
||||||
|
}}
|
||||||
|
onDelete={() => handleDelete(true)}
|
||||||
|
isQuestion={true}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<DeleteModal
|
||||||
bind:open={deleteComment.shouldDelete}
|
bind:open={deleteComment.shouldDelete}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
deleteComment.shouldDelete = false;
|
deleteComment.shouldDelete = false;
|
||||||
deleteComment.commentId = null;
|
deleteComment.commentId = '';
|
||||||
}}
|
}}
|
||||||
onDelete={handleCommentDelete}
|
onDelete={() => handleDelete(false)}
|
||||||
/>
|
/>
|
||||||
<section class="max-w-3xl mx-auto md:mx-10 lg:mb-20">
|
<section class="max-w-3xl mx-auto md:mx-10 lg:mb-20">
|
||||||
{#if !question}
|
{#if !question}
|
||||||
@@ -322,6 +400,17 @@
|
|||||||
{question.createdAt}
|
{question.createdAt}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{#if question.author.id === $profile.id || $isOrgAdmin}
|
||||||
|
<IconButton
|
||||||
|
value="delete-question"
|
||||||
|
onClick={() => {
|
||||||
|
deleteQuestion.shouldDelete = true;
|
||||||
|
deleteQuestion.questionId = question.id;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<TrashCanIcon size={16} class="carbon-icon dark:text-white" />
|
||||||
|
</IconButton>
|
||||||
|
{/if}
|
||||||
</header>
|
</header>
|
||||||
{#if isEditMode && editorInstance}
|
{#if isEditMode && editorInstance}
|
||||||
<div class="my-2">
|
<div class="my-2">
|
||||||
@@ -363,7 +452,7 @@
|
|||||||
<CheckmarkOutlineIcon size={20} />
|
<CheckmarkOutlineIcon size={20} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if comment.authorId === $profile.id}
|
{#if comment.authorId === $profile.id || $isOrgAdmin}
|
||||||
<IconButton
|
<IconButton
|
||||||
value="delete-comment"
|
value="delete-comment"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
import generateSlug from '$lib/utils/functions/generateSlug';
|
import generateSlug from '$lib/utils/functions/generateSlug';
|
||||||
import TextEditor from '$lib/components/TextEditor/index.svelte';
|
import TextEditor from '$lib/components/TextEditor/index.svelte';
|
||||||
import TextField from '$lib/components/Form/TextField.svelte';
|
import TextField from '$lib/components/Form/TextField.svelte';
|
||||||
|
import { profile } from '$lib/utils/store/user';
|
||||||
|
|
||||||
let errors: {
|
let errors: {
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
.insert({
|
.insert({
|
||||||
...fields,
|
...fields,
|
||||||
organization_id: $currentOrg.id,
|
organization_id: $currentOrg.id,
|
||||||
author_id: $currentOrg.memberId,
|
author_profile_id: $profile.id,
|
||||||
votes: 0,
|
votes: 0,
|
||||||
slug: generateSlug(fields.title)
|
slug: generateSlug(fields.title)
|
||||||
})
|
})
|
||||||
@@ -41,10 +42,11 @@
|
|||||||
console.error('Error: asking question', error);
|
console.error('Error: asking question', error);
|
||||||
snackbar.error();
|
snackbar.error();
|
||||||
} else {
|
} else {
|
||||||
console.log('Success: asking question', question);
|
const slug = question[0]?.slug;
|
||||||
|
console.log('Success: asking question in lms', question, slug);
|
||||||
snackbar.success();
|
snackbar.success();
|
||||||
|
|
||||||
goto(`/lms/community/${question[0].slug}`);
|
goto(`/lms/community/${slug}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -65,11 +67,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3 p-2">
|
<div class="mb-3 p-2">
|
||||||
<TextField
|
<TextField bind:value={fields.title} placeholder="Title" errorMessage={errors.title} />
|
||||||
bind:value={fields.title}
|
|
||||||
placeholder="Title"
|
|
||||||
errorMessage={errors.title}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TextEditor
|
<TextEditor
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
||||||
import { currentOrgPath } from '$lib/utils/store/org';
|
import { currentOrgPath } from '$lib/utils/store/org';
|
||||||
import { isMobile } from '$lib/utils/store/useMobile';
|
import { isMobile } from '$lib/utils/store/useMobile';
|
||||||
import AddFilled from 'carbon-icons-svelte/lib/AddFilled.svelte';
|
|
||||||
import Add from 'carbon-icons-svelte/lib/Add.svelte';
|
import Add from 'carbon-icons-svelte/lib/Add.svelte';
|
||||||
|
|
||||||
function askCommunity() {
|
function askCommunity() {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
import pluralize from 'pluralize';
|
import pluralize from 'pluralize';
|
||||||
import TrashCanIcon from 'carbon-icons-svelte/lib/TrashCan.svelte';
|
import TrashCanIcon from 'carbon-icons-svelte/lib/TrashCan.svelte';
|
||||||
import { SkeletonPlaceholder, SkeletonText } from 'carbon-components-svelte';
|
import { SkeletonPlaceholder, SkeletonText } from 'carbon-components-svelte';
|
||||||
@@ -9,7 +10,7 @@
|
|||||||
import Avatar from '$lib/components/Avatar/index.svelte';
|
import Avatar from '$lib/components/Avatar/index.svelte';
|
||||||
import IconButton from '$lib/components/IconButton/index.svelte';
|
import IconButton from '$lib/components/IconButton/index.svelte';
|
||||||
import CheckmarkOutlineIcon from 'carbon-icons-svelte/lib/CheckmarkOutline.svelte';
|
import CheckmarkOutlineIcon from 'carbon-icons-svelte/lib/CheckmarkOutline.svelte';
|
||||||
import { currentOrgPath, currentOrg } from '$lib/utils/store/org';
|
import { currentOrgPath, isOrgAdmin } from '$lib/utils/store/org';
|
||||||
import { profile } from '$lib/utils/store/user';
|
import { profile } from '$lib/utils/store/user';
|
||||||
import { supabase } from '$lib/utils/functions/supabase';
|
import { supabase } from '$lib/utils/functions/supabase';
|
||||||
import {
|
import {
|
||||||
@@ -18,23 +19,59 @@
|
|||||||
} from '$lib/utils/functions/validator';
|
} from '$lib/utils/functions/validator';
|
||||||
import { snackbar } from '$lib/components/Snackbar/store';
|
import { snackbar } from '$lib/components/Snackbar/store';
|
||||||
import TextField from '$lib/components/Form/TextField.svelte';
|
import TextField from '$lib/components/Form/TextField.svelte';
|
||||||
import DeleteCommentModal from '$lib/components/Org/Community/DeleteCommentModal.svelte';
|
import DeleteModal from '$lib/components/Org/Community/DeleteModal.svelte';
|
||||||
import TextEditor from '$lib/components/TextEditor/index.svelte';
|
import TextEditor from '$lib/components/TextEditor/index.svelte';
|
||||||
import { calDateDiff } from '$lib/utils/functions/date';
|
import { calDateDiff } from '$lib/utils/functions/date';
|
||||||
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
const { slug } = data;
|
const { slug } = data;
|
||||||
|
|
||||||
let question;
|
interface Comment {
|
||||||
|
id: string;
|
||||||
|
authorId: string;
|
||||||
|
name: string;
|
||||||
|
avatar: string;
|
||||||
|
votes: number;
|
||||||
|
comment: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
|
interface Question {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
votes: number;
|
||||||
|
author: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
avatar: string;
|
||||||
|
};
|
||||||
|
body: string;
|
||||||
|
createdAt: string;
|
||||||
|
comments: Comment[];
|
||||||
|
totalComments: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
let question: Question;
|
||||||
let comment = '';
|
let comment = '';
|
||||||
let errors = {};
|
let errors: {
|
||||||
|
title?: string;
|
||||||
|
} = {};
|
||||||
let isValidAnswer = false; // V2 allow admin mark an answer as accepted
|
let isValidAnswer = false; // V2 allow admin mark an answer as accepted
|
||||||
let resetInput = 1;
|
let resetInput = 1;
|
||||||
let voted = { question: false, comment: {} };
|
let voted: {
|
||||||
|
question: boolean;
|
||||||
|
comment: {
|
||||||
|
[key: string]: boolean;
|
||||||
|
};
|
||||||
|
} = { question: false, comment: {} };
|
||||||
let isEditMode = false;
|
let isEditMode = false;
|
||||||
let deleteComment = {
|
let deleteComment = {
|
||||||
shouldDelete: false,
|
shouldDelete: false,
|
||||||
commentId: null
|
commentId: ''
|
||||||
|
};
|
||||||
|
let deleteQuestion = {
|
||||||
|
shouldDelete: false,
|
||||||
|
questionId: ''
|
||||||
};
|
};
|
||||||
let editContent = {
|
let editContent = {
|
||||||
title: '',
|
title: '',
|
||||||
@@ -43,23 +80,23 @@
|
|||||||
|
|
||||||
let editorInstance = false;
|
let editorInstance = false;
|
||||||
|
|
||||||
function mapResToQuestion(data) {
|
function mapResToQuestion(data): Question {
|
||||||
return {
|
return {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
votes: data.votes,
|
votes: data.votes,
|
||||||
author: {
|
author: {
|
||||||
id: data?.author?.profile?.id || '',
|
id: data?.author?.id || '',
|
||||||
name: data?.author?.profile?.fullname || '',
|
name: data?.author?.fullname || '',
|
||||||
avatar: data?.author?.profile?.avatar_url || ''
|
avatar: data?.author?.avatar_url || ''
|
||||||
},
|
},
|
||||||
body: data.body,
|
body: data.body,
|
||||||
createdAt: calDateDiff(data.created_at),
|
createdAt: calDateDiff(data.created_at),
|
||||||
comments: data.comments.map((c) => ({
|
comments: data.comments.map((c) => ({
|
||||||
id: c.id,
|
id: c.id,
|
||||||
authorId: c.author?.profile?.id || '',
|
authorId: c.author?.id || '',
|
||||||
name: c.author?.profile?.fullname || '',
|
name: c.author?.fullname || '',
|
||||||
avatar: c.author?.profile?.avatar_url || '',
|
avatar: c.author?.avatar_url || '',
|
||||||
votes: c.votes,
|
votes: c.votes,
|
||||||
comment: c.body,
|
comment: c.body,
|
||||||
createdAt: calDateDiff(c.created_at)
|
createdAt: calDateDiff(c.created_at)
|
||||||
@@ -68,7 +105,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchCommunityQuestion(slug) {
|
async function fetchCommunityQuestion(slug: string) {
|
||||||
if (!slug) return;
|
if (!slug) return;
|
||||||
|
|
||||||
const { data, error } = await supabase
|
const { data, error } = await supabase
|
||||||
@@ -80,25 +117,22 @@
|
|||||||
body,
|
body,
|
||||||
votes,
|
votes,
|
||||||
created_at,
|
created_at,
|
||||||
|
slug,
|
||||||
comments:community_answer(
|
comments:community_answer(
|
||||||
id,
|
id,
|
||||||
body,
|
body,
|
||||||
votes,
|
votes,
|
||||||
created_at,
|
created_at,
|
||||||
author:organizationmember!community_answer_author_id_fkey!inner(
|
author:profile(id, fullname, avatar_url)
|
||||||
profile!inner(id, fullname, avatar_url)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
author:organizationmember!community_question_author_id_fkey!inner(
|
author:profile(id, fullname, avatar_url)
|
||||||
profile!inner(id, fullname, avatar_url)
|
|
||||||
)
|
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.eq('slug', slug)
|
.eq('slug', slug)
|
||||||
.single();
|
.single();
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('Error loading community', error);
|
console.error('[ORG] Error loading community', error);
|
||||||
return goto(`${currentOrgPath}`);
|
return goto(`${currentOrgPath}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +154,7 @@
|
|||||||
id: undefined,
|
id: undefined,
|
||||||
body: comment,
|
body: comment,
|
||||||
question_id: question.id,
|
question_id: question.id,
|
||||||
author_id: $currentOrg.memberId,
|
author_profile_id: $profile.id,
|
||||||
votes: 0
|
votes: 0
|
||||||
})
|
})
|
||||||
.select();
|
.select();
|
||||||
@@ -139,6 +173,7 @@
|
|||||||
...question.comments,
|
...question.comments,
|
||||||
{
|
{
|
||||||
id: _c.id,
|
id: _c.id,
|
||||||
|
authorId: $profile.id || '',
|
||||||
name: $profile?.fullname || '',
|
name: $profile?.fullname || '',
|
||||||
avatar: $profile?.avatar_url || '',
|
avatar: $profile?.avatar_url || '',
|
||||||
votes: 0,
|
votes: 0,
|
||||||
@@ -153,11 +188,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function upvoteQuestion(type, commentId) {
|
async function upvoteQuestion(type: string, commentId?: string) {
|
||||||
const isQuestion = type === 'question';
|
const isQuestion = type === 'question';
|
||||||
|
|
||||||
if (isQuestion && voted.question) return;
|
if (isQuestion && voted.question) return;
|
||||||
if (!isQuestion && voted.comment[commentId]) return;
|
if (!isQuestion && commentId && voted.comment[commentId]) return;
|
||||||
|
|
||||||
const table = isQuestion ? 'community_question' : 'community_answer';
|
const table = isQuestion ? 'community_question' : 'community_answer';
|
||||||
const matchId = isQuestion ? question.id : commentId;
|
const matchId = isQuestion ? question.id : commentId;
|
||||||
@@ -182,7 +217,7 @@
|
|||||||
} else {
|
} else {
|
||||||
if (isQuestion) {
|
if (isQuestion) {
|
||||||
voted.question = true;
|
voted.question = true;
|
||||||
} else {
|
} else if (commentId) {
|
||||||
voted.comment[commentId] = true;
|
voted.comment[commentId] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,34 +265,78 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleCommentDelete() {
|
async function handleDelete(isQuestion: boolean) {
|
||||||
const { error } = await supabase
|
if (!isQuestion) {
|
||||||
|
const { error } = await supabase
|
||||||
|
.from('community_answer')
|
||||||
|
.delete()
|
||||||
|
.match({ id: deleteComment.commentId });
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
snackbar.error('Error deleting comments');
|
||||||
|
console.log('Error deleting comments', error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
snackbar.success('Deleted successfully');
|
||||||
|
|
||||||
|
question.comments = question.comments.filter((c) => c.id !== deleteComment.commentId);
|
||||||
|
deleteComment.shouldDelete = false;
|
||||||
|
deleteComment.commentId = '';
|
||||||
|
|
||||||
|
// Handle only delete comment
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { error: commentDeleteError } = await supabase
|
||||||
.from('community_answer')
|
.from('community_answer')
|
||||||
.delete()
|
.delete()
|
||||||
.match({ id: deleteComment.commentId });
|
.match({ question_id: deleteQuestion.questionId });
|
||||||
|
|
||||||
if (!error) {
|
if (commentDeleteError) {
|
||||||
question.comments = question.comments.filter((c) => c.id !== deleteComment.commentId);
|
snackbar.error('Error deleting comments');
|
||||||
|
console.log('Error deleting comments', commentDeleteError);
|
||||||
deleteComment.shouldDelete = false;
|
return;
|
||||||
deleteComment.commentId = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { error: questionDeleteError } = await supabase
|
||||||
|
.from('community_question')
|
||||||
|
.delete()
|
||||||
|
.match({ id: deleteQuestion.questionId });
|
||||||
|
|
||||||
|
if (questionDeleteError) {
|
||||||
|
snackbar.error('Error deleting question');
|
||||||
|
console.log('Error deleting question', questionDeleteError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
snackbar.success('Deleted successfully');
|
||||||
|
goto(`${$currentOrgPath}/community`);
|
||||||
}
|
}
|
||||||
|
|
||||||
$: fetchCommunityQuestion(slug);
|
$: browser && fetchCommunityQuestion(slug);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>{question?.title || 'Question'}</title>
|
<title>{question?.title || 'Question'}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<DeleteCommentModal
|
<DeleteModal
|
||||||
|
bind:open={deleteQuestion.shouldDelete}
|
||||||
|
onCancel={() => {
|
||||||
|
deleteQuestion.shouldDelete = false;
|
||||||
|
deleteQuestion.questionId = '';
|
||||||
|
}}
|
||||||
|
onDelete={() => handleDelete(true)}
|
||||||
|
isQuestion={true}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<DeleteModal
|
||||||
bind:open={deleteComment.shouldDelete}
|
bind:open={deleteComment.shouldDelete}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
deleteComment.shouldDelete = false;
|
deleteComment.shouldDelete = false;
|
||||||
deleteComment.commentId = null;
|
deleteComment.commentId = '';
|
||||||
}}
|
}}
|
||||||
onDelete={handleCommentDelete}
|
onDelete={() => handleDelete(false)}
|
||||||
/>
|
/>
|
||||||
<section class="max-w-3xl mx-auto md:mx-10 lg:mb-20">
|
<section class="max-w-3xl mx-auto md:mx-10 lg:mb-20">
|
||||||
{#if !question}
|
{#if !question}
|
||||||
@@ -324,6 +403,17 @@
|
|||||||
{question.createdAt}
|
{question.createdAt}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{#if question.author.id === $profile.id || $isOrgAdmin}
|
||||||
|
<IconButton
|
||||||
|
value="delete-question"
|
||||||
|
onClick={() => {
|
||||||
|
deleteQuestion.shouldDelete = true;
|
||||||
|
deleteQuestion.questionId = question.id;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<TrashCanIcon size={16} class="carbon-icon dark:text-white" />
|
||||||
|
</IconButton>
|
||||||
|
{/if}
|
||||||
</header>
|
</header>
|
||||||
{#if isEditMode && editorInstance}
|
{#if isEditMode && editorInstance}
|
||||||
<div class="my-2">
|
<div class="my-2">
|
||||||
@@ -365,7 +455,7 @@
|
|||||||
<CheckmarkOutlineIcon size={20} />
|
<CheckmarkOutlineIcon size={20} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if comment.authorId === $profile.id}
|
{#if comment.authorId === $profile.id || $isOrgAdmin}
|
||||||
<IconButton
|
<IconButton
|
||||||
value="delete-comment"
|
value="delete-comment"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
import generateSlug from '$lib/utils/functions/generateSlug';
|
import generateSlug from '$lib/utils/functions/generateSlug';
|
||||||
import TextEditor from '$lib/components/TextEditor/index.svelte';
|
import TextEditor from '$lib/components/TextEditor/index.svelte';
|
||||||
import TextField from '$lib/components/Form/TextField.svelte';
|
import TextField from '$lib/components/Form/TextField.svelte';
|
||||||
|
import { profile } from '$lib/utils/store/user';
|
||||||
|
|
||||||
let errors: {
|
let errors: {
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
.insert({
|
.insert({
|
||||||
...fields,
|
...fields,
|
||||||
organization_id: $currentOrg.id,
|
organization_id: $currentOrg.id,
|
||||||
author_id: $currentOrg.memberId,
|
author_profile_id: $profile.id,
|
||||||
votes: 0,
|
votes: 0,
|
||||||
slug: generateSlug(fields.title)
|
slug: generateSlug(fields.title)
|
||||||
})
|
})
|
||||||
@@ -41,9 +42,11 @@
|
|||||||
console.error('Error: asking question', error);
|
console.error('Error: asking question', error);
|
||||||
snackbar.error('Error - Please try again later');
|
snackbar.error('Error - Please try again later');
|
||||||
} else {
|
} else {
|
||||||
console.log('Success: asking question', question);
|
const slug = question[0]?.slug;
|
||||||
|
|
||||||
|
console.log('Success: asking question', question, slug);
|
||||||
snackbar.success('Question Submitted!');
|
snackbar.success('Question Submitted!');
|
||||||
goto(`${$currentOrgPath}/community/${question[0].slug}`);
|
goto(`${$currentOrgPath}/community/${slug}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -67,11 +70,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3 p-2">
|
<div class="mb-3 p-2">
|
||||||
<TextField
|
<TextField bind:value={fields.title} placeholder="Title" errorMessage={errors.title} />
|
||||||
bind:value={fields.title}
|
|
||||||
placeholder="Title"
|
|
||||||
errorMessage={errors.title}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="px-2">
|
<div class="px-2">
|
||||||
<TextEditor
|
<TextEditor
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."course" alter column "metadata" set default '{"goals": "", "description": "", "requirements": ""}'::jsonb;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
alter table "public"."community_answer" add column "author_profile_id" uuid;
|
||||||
|
|
||||||
|
alter table "public"."community_question" add column "author_profile_id" uuid;
|
||||||
|
|
||||||
|
alter table "public"."community_answer" add constraint "community_answer_author_profile_id_fkey" FOREIGN KEY (author_profile_id) REFERENCES profile(id) not valid;
|
||||||
|
|
||||||
|
alter table "public"."community_answer" validate constraint "community_answer_author_profile_id_fkey";
|
||||||
|
|
||||||
|
alter table "public"."community_question" add constraint "community_question_author_profile_id_fkey" FOREIGN KEY (author_profile_id) REFERENCES profile(id) not valid;
|
||||||
|
|
||||||
|
alter table "public"."community_question" validate constraint "community_question_author_profile_id_fkey";
|
||||||
Reference in New Issue
Block a user