feat: add content management feature for superadmin
- Implemented API endpoint for fetching content list with filtering, sorting, and pagination. - Added DTOs for content items and tenant information. - Created frontend components for content management, including search and data table functionalities. - Updated routing to include content management page. - Enhanced the superadmin menu to navigate to the new content management section. - Included necessary styles and scripts for the new content management interface.
This commit is contained in:
81
backend/app/http/super/dto/content_page.go
Normal file
81
backend/app/http/super/dto/content_page.go
Normal file
@@ -0,0 +1,81 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/database/models"
|
||||
"quyun/v2/pkg/consts"
|
||||
)
|
||||
|
||||
type SuperContentPageFilter struct {
|
||||
requests.Pagination `json:",inline" query:",inline"`
|
||||
requests.SortQueryFilter `json:",inline" query:",inline"`
|
||||
|
||||
ID *int64 `json:"id,omitempty" query:"id"`
|
||||
|
||||
TenantID *int64 `json:"tenant_id,omitempty" query:"tenant_id"`
|
||||
TenantCode *string `json:"tenant_code,omitempty" query:"tenant_code"`
|
||||
TenantName *string `json:"tenant_name,omitempty" query:"tenant_name"`
|
||||
|
||||
UserID *int64 `json:"user_id,omitempty" query:"user_id"`
|
||||
Username *string `json:"username,omitempty" query:"username"`
|
||||
|
||||
Keyword *string `json:"keyword,omitempty" query:"keyword"`
|
||||
|
||||
Status *consts.ContentStatus `json:"status,omitempty" query:"status"`
|
||||
Visibility *consts.ContentVisibility `json:"visibility,omitempty" query:"visibility"`
|
||||
|
||||
PublishedAtFrom *time.Time `json:"published_at_from,omitempty" query:"published_at_from"`
|
||||
PublishedAtTo *time.Time `json:"published_at_to,omitempty" query:"published_at_to"`
|
||||
CreatedAtFrom *time.Time `json:"created_at_from,omitempty" query:"created_at_from"`
|
||||
CreatedAtTo *time.Time `json:"created_at_to,omitempty" query:"created_at_to"`
|
||||
|
||||
PriceAmountMin *int64 `json:"price_amount_min,omitempty" query:"price_amount_min"`
|
||||
PriceAmountMax *int64 `json:"price_amount_max,omitempty" query:"price_amount_max"`
|
||||
}
|
||||
|
||||
func (f *SuperContentPageFilter) KeywordTrimmed() string {
|
||||
if f == nil || f.Keyword == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(*f.Keyword)
|
||||
}
|
||||
|
||||
func (f *SuperContentPageFilter) TenantCodeTrimmed() string {
|
||||
if f == nil || f.TenantCode == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.ToLower(strings.TrimSpace(*f.TenantCode))
|
||||
}
|
||||
|
||||
func (f *SuperContentPageFilter) TenantNameTrimmed() string {
|
||||
if f == nil || f.TenantName == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(*f.TenantName)
|
||||
}
|
||||
|
||||
func (f *SuperContentPageFilter) UsernameTrimmed() string {
|
||||
if f == nil || f.Username == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(*f.Username)
|
||||
}
|
||||
|
||||
type SuperContentTenantLite struct {
|
||||
ID int64 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type SuperContentItem struct {
|
||||
Content *models.Content `json:"content,omitempty"`
|
||||
Price *models.ContentPrice `json:"price,omitempty"`
|
||||
Tenant *SuperContentTenantLite `json:"tenant,omitempty"`
|
||||
Owner *SuperUserLite `json:"owner,omitempty"`
|
||||
|
||||
StatusDescription string `json:"status_description,omitempty"`
|
||||
VisibilityDescription string `json:"visibility_description,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user