feat: file type.
This commit is contained in:
@@ -218,6 +218,31 @@ func (tc *TrainingController) UploadTrainingSession(c *gin.Context) {
|
||||
writeSuccess(c, http.StatusOK, "session updated", nil)
|
||||
}
|
||||
|
||||
type cloudLessonPlanItem struct {
|
||||
ID uint `json:"id"`
|
||||
OriginalFilename string `json:"originalFilename"`
|
||||
FileSize int64 `json:"fileSize"`
|
||||
UploaderName string `json:"uploaderName"`
|
||||
}
|
||||
|
||||
func (tc *TrainingController) ListCloudLessonPlans(c *gin.Context) {
|
||||
var records []models.AppFile
|
||||
if err := tc.DB.Where("file_type = ?", models.AppFileTypeLessonPlan).Order("created_at DESC").Find(&records).Error; err != nil {
|
||||
writeError(c, http.StatusInternalServerError, "failed to list lesson plans")
|
||||
return
|
||||
}
|
||||
items := make([]cloudLessonPlanItem, 0, len(records))
|
||||
for _, r := range records {
|
||||
items = append(items, cloudLessonPlanItem{
|
||||
ID: r.ID,
|
||||
OriginalFilename: r.OriginalFilename,
|
||||
FileSize: r.FileSize,
|
||||
UploaderName: r.UploaderName,
|
||||
})
|
||||
}
|
||||
writeSuccess(c, http.StatusOK, "query success", items)
|
||||
}
|
||||
|
||||
// analysis_response.go
|
||||
type AnalysisResponse struct {
|
||||
Status string `json:"status"` // 状态码
|
||||
|
||||
Reference in New Issue
Block a user