Files
LazyPM/internal/commands/survey/start.go
Robin Olsen 72a2e8acf5 Metrics and logs - MongoDB Submission (#43)
Adds MongoDB-backed submission for survey statistics/metrics and introduces MongoDB ObjectID-based participant/task identifiers to support upserts and linking metrics to a participant.

It introduces breaking changes to the exsisting json stat and metric files. Delete the old ones

Changes:

Add internal/storage/MongoStorage and wire pm survey submit / pm start to submit local .pm/*.json files to MongoDB.
Extend stats/metrics models to include MongoDB _id / participant_id fields and add participant ID propagation into task metrics.
Update app initialization to generate ObjectIDs for new participants and expose GetParticipantID() via StatsService.
2026-03-10 14:09:31 +01:00

28 lines
870 B
Go

package survey
import (
"github.com/LazyBachelor/LazyPM/internal/utils/shellcomp"
"github.com/LazyBachelor/LazyPM/pkg/task"
"github.com/spf13/cobra"
)
var (
DevFlag bool
InterfaceType string
Task string
)
// StartCmd is the start command - RunE is set in cmd/survey/
var StartCmd = &cobra.Command{
Use: "start",
Short: "Start the user survey",
}
func init() {
StartCmd.Flags().StringVarP(&Task, "task", "t", "", "Specify task.")
StartCmd.Flags().StringVarP(&InterfaceType, "interface", "i", "", "Specify interface.")
StartCmd.RegisterFlagCompletionFunc("task", shellcomp.CompletionFunc(task.ListTasks()))
StartCmd.RegisterFlagCompletionFunc("interface", shellcomp.CompletionFunc(task.ListInterfaces()))
StartCmd.Flags().BoolVar(&DevFlag, "dev", false, "Enable development mode, which skips database connection, submission and intro")
}