Files
rustdesk-api/service/shareRecord.go
T
thomasandClaude Opus 4.8 16e97c8efa i18n: Translate all Chinese to English across the codebase
Translate Chinese comments, log/error messages, validator labels and
Swagger annotations to English throughout the source code, generated
Swagger docs, config files and CI workflows.

Make the English README primary: README.md now holds the English docs
and README_EN.md holds the Chinese version, with cross-language links
updated accordingly.

Note: the generated docs/ swagger files were translated in place; run
`go generate ./...` (swag init) to regenerate them from the now-English
annotations when a Go toolchain is available.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 12:17:04 +02:00

49 lines
1.1 KiB
Go

package service
import (
"github.com/lejianwen/rustdesk-api/v2/model"
"gorm.io/gorm"
)
type ShareRecordService struct {
}
// InfoById gets the share record info by id
func (srs *ShareRecordService) InfoById(id uint) *model.ShareRecord {
u := &model.ShareRecord{}
DB.Where("id = ?", id).First(u)
return u
}
func (srs *ShareRecordService) List(page, pageSize uint, where func(tx *gorm.DB)) (res *model.ShareRecordList) {
res = &model.ShareRecordList{}
res.Page = int64(page)
res.PageSize = int64(pageSize)
tx := DB.Model(&model.ShareRecord{})
if where != nil {
where(tx)
}
tx.Count(&res.Total)
tx.Scopes(Paginate(page, pageSize))
tx.Find(&res.ShareRecords)
return
}
// Create create
func (srs *ShareRecordService) Create(u *model.ShareRecord) error {
res := DB.Create(u).Error
return res
}
func (srs *ShareRecordService) Delete(u *model.ShareRecord) error {
return DB.Delete(u).Error
}
// Update update
func (srs *ShareRecordService) Update(u *model.ShareRecord) error {
return DB.Model(u).Updates(u).Error
}
func (srs *ShareRecordService) BatchDelete(ids []uint) error {
return DB.Where("id in (?)", ids).Delete(&model.ShareRecord{}).Error
}