Add incident created_at
This commit is contained in:
parent
3a4c90d12f
commit
04977b5468
7 changed files with 21 additions and 3 deletions
|
@ -61,6 +61,7 @@ INSERT INTO incidents (
|
||||||
name,
|
name,
|
||||||
owner,
|
owner,
|
||||||
description,
|
description,
|
||||||
|
created_at,
|
||||||
start_time,
|
start_time,
|
||||||
end_time,
|
end_time,
|
||||||
location,
|
location,
|
||||||
|
@ -70,12 +71,13 @@ INSERT INTO incidents (
|
||||||
$2,
|
$2,
|
||||||
$3,
|
$3,
|
||||||
$4,
|
$4,
|
||||||
|
NOW(),
|
||||||
$5,
|
$5,
|
||||||
$6,
|
$6,
|
||||||
$7,
|
$7,
|
||||||
$8
|
$8
|
||||||
)
|
)
|
||||||
RETURNING id, name, owner, description, start_time, end_time, location, metadata
|
RETURNING id, name, owner, description, created_at, start_time, end_time, location, metadata
|
||||||
`
|
`
|
||||||
|
|
||||||
type CreateIncidentParams struct {
|
type CreateIncidentParams struct {
|
||||||
|
@ -106,6 +108,7 @@ func (q *Queries) CreateIncident(ctx context.Context, arg CreateIncidentParams)
|
||||||
&i.Name,
|
&i.Name,
|
||||||
&i.Owner,
|
&i.Owner,
|
||||||
&i.Description,
|
&i.Description,
|
||||||
|
&i.CreatedAt,
|
||||||
&i.StartTime,
|
&i.StartTime,
|
||||||
&i.EndTime,
|
&i.EndTime,
|
||||||
&i.Location,
|
&i.Location,
|
||||||
|
@ -129,6 +132,7 @@ SELECT
|
||||||
i.name,
|
i.name,
|
||||||
i.owner,
|
i.owner,
|
||||||
i.description,
|
i.description,
|
||||||
|
i.created_at,
|
||||||
i.start_time,
|
i.start_time,
|
||||||
i.end_time,
|
i.end_time,
|
||||||
i.location,
|
i.location,
|
||||||
|
@ -145,6 +149,7 @@ func (q *Queries) GetIncident(ctx context.Context, id uuid.UUID) (Incident, erro
|
||||||
&i.Name,
|
&i.Name,
|
||||||
&i.Owner,
|
&i.Owner,
|
||||||
&i.Description,
|
&i.Description,
|
||||||
|
&i.CreatedAt,
|
||||||
&i.StartTime,
|
&i.StartTime,
|
||||||
&i.EndTime,
|
&i.EndTime,
|
||||||
&i.Location,
|
&i.Location,
|
||||||
|
@ -297,6 +302,7 @@ SELECT
|
||||||
i.name,
|
i.name,
|
||||||
i.owner,
|
i.owner,
|
||||||
i.description,
|
i.description,
|
||||||
|
i.created_at,
|
||||||
i.start_time,
|
i.start_time,
|
||||||
i.end_time,
|
i.end_time,
|
||||||
i.location,
|
i.location,
|
||||||
|
@ -335,6 +341,7 @@ type ListIncidentsPRow struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Owner int `json:"owner"`
|
Owner int `json:"owner"`
|
||||||
Description *string `json:"description"`
|
Description *string `json:"description"`
|
||||||
|
CreatedAt pgtype.Timestamptz `json:"createdAt"`
|
||||||
StartTime pgtype.Timestamptz `json:"startTime"`
|
StartTime pgtype.Timestamptz `json:"startTime"`
|
||||||
EndTime pgtype.Timestamptz `json:"endTime"`
|
EndTime pgtype.Timestamptz `json:"endTime"`
|
||||||
Location []byte `json:"location"`
|
Location []byte `json:"location"`
|
||||||
|
@ -363,6 +370,7 @@ func (q *Queries) ListIncidentsP(ctx context.Context, arg ListIncidentsPParams)
|
||||||
&i.Name,
|
&i.Name,
|
||||||
&i.Owner,
|
&i.Owner,
|
||||||
&i.Description,
|
&i.Description,
|
||||||
|
&i.CreatedAt,
|
||||||
&i.StartTime,
|
&i.StartTime,
|
||||||
&i.EndTime,
|
&i.EndTime,
|
||||||
&i.Location,
|
&i.Location,
|
||||||
|
@ -411,7 +419,7 @@ SET
|
||||||
metadata = COALESCE($6, metadata)
|
metadata = COALESCE($6, metadata)
|
||||||
WHERE
|
WHERE
|
||||||
id = $7
|
id = $7
|
||||||
RETURNING id, name, owner, description, start_time, end_time, location, metadata
|
RETURNING id, name, owner, description, created_at, start_time, end_time, location, metadata
|
||||||
`
|
`
|
||||||
|
|
||||||
type UpdateIncidentParams struct {
|
type UpdateIncidentParams struct {
|
||||||
|
@ -440,6 +448,7 @@ func (q *Queries) UpdateIncident(ctx context.Context, arg UpdateIncidentParams)
|
||||||
&i.Name,
|
&i.Name,
|
||||||
&i.Owner,
|
&i.Owner,
|
||||||
&i.Description,
|
&i.Description,
|
||||||
|
&i.CreatedAt,
|
||||||
&i.StartTime,
|
&i.StartTime,
|
||||||
&i.EndTime,
|
&i.EndTime,
|
||||||
&i.Location,
|
&i.Location,
|
||||||
|
|
|
@ -60,6 +60,7 @@ type Incident struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Owner int `json:"owner,omitempty"`
|
Owner int `json:"owner,omitempty"`
|
||||||
Description *string `json:"description,omitempty"`
|
Description *string `json:"description,omitempty"`
|
||||||
|
CreatedAt pgtype.Timestamptz `json:"createdAt,omitempty"`
|
||||||
StartTime pgtype.Timestamptz `json:"startTime,omitempty"`
|
StartTime pgtype.Timestamptz `json:"startTime,omitempty"`
|
||||||
EndTime pgtype.Timestamptz `json:"endTime,omitempty"`
|
EndTime pgtype.Timestamptz `json:"endTime,omitempty"`
|
||||||
Location []byte `json:"location,omitempty"`
|
Location []byte `json:"location,omitempty"`
|
||||||
|
|
|
@ -19,6 +19,7 @@ type Incident struct {
|
||||||
Owner users.UserID `json:"owner"`
|
Owner users.UserID `json:"owner"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description *string `json:"description,omitempty"`
|
Description *string `json:"description,omitempty"`
|
||||||
|
CreatedAt jsontypes.Time `json:"createdAt"`
|
||||||
StartTime *jsontypes.Time `json:"startTime,omitempty"`
|
StartTime *jsontypes.Time `json:"startTime,omitempty"`
|
||||||
EndTime *jsontypes.Time `json:"endTime,omitempty"`
|
EndTime *jsontypes.Time `json:"endTime,omitempty"`
|
||||||
Location jsontypes.Location `json:"location,omitempty"`
|
Location jsontypes.Location `json:"location,omitempty"`
|
||||||
|
|
|
@ -231,6 +231,7 @@ func fromDBIncident(id uuid.UUID, d database.Incident) incidents.Incident {
|
||||||
Owner: users.UserID(d.Owner),
|
Owner: users.UserID(d.Owner),
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
Description: d.Description,
|
Description: d.Description,
|
||||||
|
CreatedAt: jsontypes.Time(d.CreatedAt.Time),
|
||||||
StartTime: jsontypes.TimePtrFromTSTZ(d.StartTime),
|
StartTime: jsontypes.TimePtrFromTSTZ(d.StartTime),
|
||||||
EndTime: jsontypes.TimePtrFromTSTZ(d.EndTime),
|
EndTime: jsontypes.TimePtrFromTSTZ(d.EndTime),
|
||||||
Metadata: d.Metadata,
|
Metadata: d.Metadata,
|
||||||
|
@ -250,6 +251,7 @@ func fromDBListInPRow(id uuid.UUID, d database.ListIncidentsPRow) Incident {
|
||||||
Owner: users.UserID(d.Owner),
|
Owner: users.UserID(d.Owner),
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
Description: d.Description,
|
Description: d.Description,
|
||||||
|
CreatedAt: jsontypes.Time(d.CreatedAt.Time),
|
||||||
StartTime: jsontypes.TimePtrFromTSTZ(d.StartTime),
|
StartTime: jsontypes.TimePtrFromTSTZ(d.StartTime),
|
||||||
EndTime: jsontypes.TimePtrFromTSTZ(d.EndTime),
|
EndTime: jsontypes.TimePtrFromTSTZ(d.EndTime),
|
||||||
Metadata: d.Metadata,
|
Metadata: d.Metadata,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.33.0
|
// protoc-gen-go v1.33.0
|
||||||
// protoc v5.28.3
|
// protoc v5.29.3
|
||||||
// source: stillbox.proto
|
// source: stillbox.proto
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
|
@ -143,6 +143,7 @@ CREATE TABLE IF NOT EXISTS incidents(
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
owner INTEGER NOT NULL,
|
owner INTEGER NOT NULL,
|
||||||
description TEXT,
|
description TEXT,
|
||||||
|
created_at TIMESTAMPTZ,
|
||||||
start_time TIMESTAMPTZ,
|
start_time TIMESTAMPTZ,
|
||||||
end_time TIMESTAMPTZ,
|
end_time TIMESTAMPTZ,
|
||||||
location JSONB,
|
location JSONB,
|
||||||
|
|
|
@ -42,6 +42,7 @@ INSERT INTO incidents (
|
||||||
name,
|
name,
|
||||||
owner,
|
owner,
|
||||||
description,
|
description,
|
||||||
|
created_at,
|
||||||
start_time,
|
start_time,
|
||||||
end_time,
|
end_time,
|
||||||
location,
|
location,
|
||||||
|
@ -51,6 +52,7 @@ INSERT INTO incidents (
|
||||||
@name,
|
@name,
|
||||||
@owner,
|
@owner,
|
||||||
sqlc.narg('description'),
|
sqlc.narg('description'),
|
||||||
|
NOW(),
|
||||||
sqlc.narg('start_time'),
|
sqlc.narg('start_time'),
|
||||||
sqlc.narg('end_time'),
|
sqlc.narg('end_time'),
|
||||||
sqlc.narg('location'),
|
sqlc.narg('location'),
|
||||||
|
@ -65,6 +67,7 @@ SELECT
|
||||||
i.name,
|
i.name,
|
||||||
i.owner,
|
i.owner,
|
||||||
i.description,
|
i.description,
|
||||||
|
i.created_at,
|
||||||
i.start_time,
|
i.start_time,
|
||||||
i.end_time,
|
i.end_time,
|
||||||
i.location,
|
i.location,
|
||||||
|
@ -160,6 +163,7 @@ SELECT
|
||||||
i.name,
|
i.name,
|
||||||
i.owner,
|
i.owner,
|
||||||
i.description,
|
i.description,
|
||||||
|
i.created_at,
|
||||||
i.start_time,
|
i.start_time,
|
||||||
i.end_time,
|
i.end_time,
|
||||||
i.location,
|
i.location,
|
||||||
|
|
Loading…
Add table
Reference in a new issue