fix: public-packages should only return published course packages
Add `published_at IS NOT NULL` filter to the public-packages query. Unpublished packages (ACTIVE status but no published_at) should not appear in the student-facing store. Two new model methods added: - find_all_published_by_org_with_page - find_all_published_with_page Existing find_all_active_* methods unchanged for admin use. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -235,8 +235,8 @@ pub async fn find_public_course_packages(
|
||||
let page_size = get_some_from_query_params::<i64>("page_size", ¶ms).unwrap_or(20);
|
||||
let keyword = get_some_from_query_params::<String>("keyword", ¶ms);
|
||||
match params.get("org_id") {
|
||||
Some(org_id) => CoursePackage::find_all_active_by_org_with_page(org_id, &keyword, page, page_size, extract_conn(fetch_db_conn(&db_pool)?).deref_mut()),
|
||||
None => CoursePackage::find_all_active_with_page(&keyword, page, page_size, extract_conn(fetch_db_conn(&db_pool)?).deref_mut()),
|
||||
Some(org_id) => CoursePackage::find_all_published_by_org_with_page(org_id, &keyword, page, page_size, extract_conn(fetch_db_conn(&db_pool)?).deref_mut()),
|
||||
None => CoursePackage::find_all_published_with_page(&keyword, page, page_size, extract_conn(fetch_db_conn(&db_pool)?).deref_mut()),
|
||||
}
|
||||
})();
|
||||
match result {
|
||||
|
||||
Reference in New Issue
Block a user