func (db *DB) GetTeamFlag(teamid int64, id int64) (*api.Flag, error) {
	resp := api.Flag{}
	err := db.QueryRow("SELECT score.flagid, flag.description, score.value, score.notes, score.submit_time, flag.return_string FROM score LEFT JOIN flag ON flag.id=score.flagid WHERE score.teamid=$1 AND score.flagid=$2 ORDER BY score.submit_time ASC;", teamid, id).Scan(
		&resp.ID, &resp.Description, &resp.Value, &resp.Notes, &resp.SubmitTime, &resp.ReturnString)
	if err != nil {
		return nil, err
	}
	return &resp, nil
}
GetTeamFlag retrieves a single score entry for the team
package database
import (
	"database/sql"
	"os"
	"time"
	"github.com/nsec/askgod/api"
	"github.com/nsec/askgod/internal/utils"
)
func (db *DB) GetTeamPoints(teamid int64) (int64, error) {
	total := int64(0)
	err := db.QueryRow("SELECT COALESCE(SUM(score.value), 0) AS points FROM score WHERE teamid=$1", teamid).Scan(&total)
	if err != nil {
		return -1, err
	}
	return total, nil
}
func (db *DB) GetTeamFlags(teamid int64) ([]api.Flag, error) {
	resp := []api.Flag{}
	rows, err := db.Query("SELECT score.flagid, flag.description, score.value, score.notes, score.submit_time, flag.return_string FROM score LEFT JOIN flag ON flag.id=score.flagid WHERE score.teamid=$1 ORDER BY score.submit_time ASC;", teamid)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	for rows.Next() {
		row := api.Flag{}
		err := rows.Scan(&row.ID, &row.Description, &row.Value, &row.Notes, &row.SubmitTime, &row.ReturnString)
		if err != nil {
			return nil, err
		}
		resp = append(resp, row)
	}
	err = rows.Err()
	if err != nil {
		return nil, err
	}
	return resp, nil
}