Get rid of duration

This commit is contained in:
Brandon Dyck 2020-03-31 22:40:06 -06:00
parent ab3aaaea24
commit da4cbc4c50
2 changed files with 3 additions and 9 deletions

View File

@ -136,7 +136,6 @@ func pageDoCreate(name, description string, earliest, latest time.Time) h.Term {
Description: description,
EarliestDate: earliest,
LatestDate: latest,
Duration: 1,
})
if err != nil {
return h.Text(err.Error())

View File

@ -63,7 +63,6 @@ const schema = `
description TEXT NOT NULL,
earliest_date DATE NOT NULL,
latest_date DATE NOT NULL,
duration INTEGER NOT NULL,
UNIQUE (alpha_id)
);
@ -94,7 +93,6 @@ type CreateEventCommand struct {
Name string
Description string
EarliestDate, LatestDate time.Time
Duration int
}
type CreateEventResult struct {
@ -118,8 +116,8 @@ func (s *Store) CreateEvent(ctx context.Context, cmd CreateEventCommand) (result
}
const query = `
INSERT INTO event(alpha_id, admin_code, name, description, earliest_date, latest_date, duration)
VALUES (?, ?, ?, ?, ?, ?, ?);`
INSERT INTO event(alpha_id, admin_code, name, description, earliest_date, latest_date)
VALUES (?, ?, ?, ?, ?, ?);`
err = sqlitex.Exec(conn, query, nil,
alphaID,
adminCode,
@ -127,7 +125,6 @@ func (s *Store) CreateEvent(ctx context.Context, cmd CreateEventCommand) (result
cmd.Description,
cmd.EarliestDate.Format(dateFmt),
cmd.LatestDate.Format(dateFmt),
cmd.Duration,
)
if err != nil {
return
@ -146,7 +143,6 @@ type GetEventResult struct {
Name string
Description string
EarliestDate, LatestDate time.Time
Duration int
}
func (s *Store) GetEvent(ctx context.Context, query GetEventQuery) (GetEventResult, error) {
@ -154,7 +150,7 @@ func (s *Store) GetEvent(ctx context.Context, query GetEventQuery) (GetEventResu
defer s.pool.Put(conn)
const dbQuery = `
SELECT name, description, earliest_date, latest_date, duration
SELECT name, description, earliest_date, latest_date
FROM event
WHERE alpha_id = ?;`
var result GetEventResult
@ -167,7 +163,6 @@ func (s *Store) GetEvent(ctx context.Context, query GetEventQuery) (GetEventResu
result.Description = stmt.ColumnText(1)
earliestDateString := stmt.ColumnText(2)
latestDateString := stmt.ColumnText(3)
result.Duration = stmt.ColumnInt(4)
var err error
result.EarliestDate, err = time.Parse(dateFmt, earliestDateString)