Add more gitignore
This commit is contained in:
@ -11,11 +11,6 @@ type CaptureService struct {
|
||||
p models.Persistence
|
||||
}
|
||||
|
||||
var mockCaptures = []models.Capture{
|
||||
{ID: 1, Host: "80.57.28.137", Port: "28960", Active: true, Name: "Gungame HAW-LAN 11", Start: time.Now().Add(-1 * time.Hour)},
|
||||
{ID: 1, Host: "80.57.28.137", Port: "28960", Active: true, Name: "Gungame HAW-LAN 12", Start: time.Now().Add(-5 * time.Minute)},
|
||||
}
|
||||
|
||||
func NewCaptureService(persistence models.Persistence) *CaptureService {
|
||||
return &CaptureService{
|
||||
p: persistence,
|
||||
@ -26,6 +21,10 @@ func (cs *CaptureService) CreateCapture(ctx context.Context, capture *models.Cap
|
||||
return cs.p.CreateCapture(ctx, capture)
|
||||
}
|
||||
|
||||
func (cs *CaptureService) DeleteCapture(ctx context.Context, id int64) error {
|
||||
return cs.p.DeleteCapture(ctx, id)
|
||||
}
|
||||
|
||||
func (cs *CaptureService) GetActiveCapures(ctx context.Context) ([]models.Capture, error) {
|
||||
captures, err := cs.p.GetCaptures(ctx)
|
||||
if err != nil {
|
||||
@ -42,26 +41,20 @@ func (cs *CaptureService) GetActiveCapures(ctx context.Context) ([]models.Captur
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (cs *CaptureService) GetCaptureById(id int) (*models.Capture, error) {
|
||||
capture := mockCaptures[0]
|
||||
func (cs *CaptureService) GetServerStatus(ctx context.Context, capture *models.Capture) (*models.CoD4ServerStatus, error) {
|
||||
server, err := models.NewCOD4ServerStatus(capture.Host, capture.Port, time.Second)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
status, err := server.GetServerStatus()
|
||||
return server.GetServerStatus()
|
||||
}
|
||||
|
||||
func (cs *CaptureService) GetCaptureById(ctx context.Context, id int64) (*models.Capture, error) {
|
||||
capture, err := cs.p.GetCapturesByID(ctx, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
capture.MapScores = []models.MapScore{
|
||||
{
|
||||
ID: 0,
|
||||
StartTime: status.MapStartTime,
|
||||
Map: status.MapName,
|
||||
ScoreList: status.Score,
|
||||
},
|
||||
}
|
||||
|
||||
return &capture, nil
|
||||
return capture, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user