File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,27 @@ export const publishNode = async ({
4343 if ( publishResponse . error && publishResponse . error . code !== "23505" )
4444 // 23505 is duplicate key, which counts as a success.
4545 throw publishResponse . error ;
46+ // check if there is a corresponding concept.
47+ const conceptIdResponse = await client
48+ . from ( "Concept" )
49+ . select ( "id" )
50+ . eq ( "represented_by_id" , contentId )
51+ . maybeSingle ( ) ;
52+ if ( conceptIdResponse . error ) throw conceptIdResponse . error ;
53+ if ( conceptIdResponse . data ) {
54+ const publishConceptResponse = await client . from ( "ConceptAccess" ) . insert ( {
55+ /* eslint-disable @typescript-eslint/naming-convention */
56+ account_uid : myGroup ,
57+ concept_id : conceptIdResponse . data . id ,
58+ /* eslint-enable @typescript-eslint/naming-convention */
59+ } ) ;
60+ if (
61+ publishConceptResponse . error &&
62+ publishConceptResponse . error . code !== "23505"
63+ )
64+ // 23505 is duplicate key, which counts as a success.
65+ throw publishConceptResponse . error ;
66+ }
4667 await plugin . app . fileManager . processFrontMatter (
4768 file ,
4869 ( fm : Record < string , unknown > ) => {
You can’t perform that action at this time.
0 commit comments