-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(database): add new section * chore(backend): add section to prefs for new users * feat(frontend): add pro required label * chore(frontend): order of props * feat(frontend): choose a default provider for new progress updates
- Loading branch information
Showing
6 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
libs/database/src/migrations/m20240805_add_new_section_to_dashboard.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use sea_orm_migration::prelude::*; | ||
|
||
#[derive(DeriveMigrationName)] | ||
pub struct Migration; | ||
|
||
#[async_trait::async_trait] | ||
impl MigrationTrait for Migration { | ||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
let db = manager.get_connection(); | ||
db.execute_unprepared( | ||
r#" | ||
UPDATE "user" | ||
SET preferences = jsonb_set( | ||
preferences, | ||
'{general, dashboard}', | ||
( | ||
CASE | ||
WHEN NOT EXISTS ( | ||
SELECT 1 | ||
FROM jsonb_array_elements(COALESCE(preferences->'general'->'dashboard', '[]'::jsonb)) AS elem | ||
WHERE elem->>'section' = 'RECOMMENDATIONS' | ||
) | ||
THEN COALESCE(preferences->'general'->'dashboard', '[]'::jsonb) || | ||
jsonb_build_array(jsonb_build_object('hidden', false, 'section', 'RECOMMENDATIONS', 'numElements', 8)) | ||
ELSE COALESCE(preferences->'general'->'dashboard', '[]'::jsonb) | ||
END | ||
)::jsonb, | ||
true | ||
) | ||
WHERE preferences->'general'->'dashboard' IS NOT NULL; | ||
"#, | ||
) | ||
.await?; | ||
|
||
Ok(()) | ||
} | ||
|
||
async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> { | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters