feat: update template

This commit is contained in:
2026-08-19 22:05:49 +08:00
parent 0e674e9d56
commit 5a71093b0c
67 changed files with 2070 additions and 585 deletions

View File

@@ -0,0 +1,42 @@
package admin
import (
"context"
"server/internal/db"
"server/internal/db/sqlc"
"server/internal/model/common"
)
type AccessLogService struct {
store *db.Store
}
func NewAccessLogService(store *db.Store) *AccessLogService {
return &AccessLogService{
store: store,
}
}
func (s *AccessLogService) List(ctx context.Context, p *common.Pagination) (*common.PageResult[sqlc.ListAccessLogsRow], error) {
params := sqlc.ListAccessLogsParams{
Limit: p.PageSize,
Offset: (p.Page - 1) * p.PageSize,
}
total, err := s.store.CountAccessLogs(ctx)
if err != nil {
return nil, err
}
list, err := s.store.ListAccessLogs(ctx, params)
if err != nil {
return nil, err
}
return &common.PageResult[sqlc.ListAccessLogsRow]{
Total: total,
List: list,
}, nil
}