mirror of
https://github.com/modrinth/code.git
synced 2026-09-02 04:56:52 +00:00
feat(labrinth): separate out ai functionality into its own disclosure
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
INSERT INTO project_disclosures (project_id, type, metadata, updated_at, updated_by, set_by_moderator, deleted_at, lock_status)
|
||||||
|
SELECT
|
||||||
|
project_id,
|
||||||
|
'ai_functionality',
|
||||||
|
'{"note":null}'::jsonb,
|
||||||
|
now(),
|
||||||
|
0,
|
||||||
|
set_by_moderator,
|
||||||
|
deleted_at,
|
||||||
|
lock_status
|
||||||
|
FROM project_disclosures
|
||||||
|
WHERE type = 'ai_content'
|
||||||
|
AND metadata -> 'uses' ? 'functionality'
|
||||||
|
ON CONFLICT (project_id, type) DO NOTHING;
|
||||||
|
|
||||||
|
DELETE FROM project_disclosures
|
||||||
|
WHERE type = 'ai_content'
|
||||||
|
AND metadata -> 'uses' ? 'functionality'
|
||||||
|
AND jsonb_array_length(metadata -> 'uses') = 1;
|
||||||
|
|
||||||
|
UPDATE project_disclosures
|
||||||
|
SET metadata = jsonb_set(metadata, '{uses}', (metadata -> 'uses') - 'functionality')
|
||||||
|
WHERE type = 'ai_content'
|
||||||
|
AND metadata -> 'uses' ? 'functionality';
|
||||||
@@ -18,6 +18,9 @@ pub enum ProjectDisclosure {
|
|||||||
note: Option<String>,
|
note: Option<String>,
|
||||||
uses: BTreeSet<AiUsages>,
|
uses: BTreeSet<AiUsages>,
|
||||||
},
|
},
|
||||||
|
AiFunctionality {
|
||||||
|
note: Option<String>,
|
||||||
|
},
|
||||||
Advertisements {
|
Advertisements {
|
||||||
note: Option<String>,
|
note: Option<String>,
|
||||||
},
|
},
|
||||||
@@ -161,7 +164,6 @@ pub enum AiUsages {
|
|||||||
Code,
|
Code,
|
||||||
Assets,
|
Assets,
|
||||||
Text,
|
Text,
|
||||||
Functionality,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, IntoStaticStr)]
|
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, IntoStaticStr)]
|
||||||
|
|||||||
Reference in New Issue
Block a user