Skip to content

feat(coderd): add last_seen_at and version to provisioner_daemons table #11033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rm omitempty on ProvisionerDaemon.Version
  • Loading branch information
johnstcn committed Dec 5, 2023
commit 99f761099827afa08f662dc526436f600fc6640b
2 changes: 1 addition & 1 deletion codersdk/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type ProvisionerDaemon struct {
UpdatedAt sql.NullTime `json:"updated_at" format:"date-time"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: just spotted, if this is sql.NullTime, then the property should have omitempty.

Copy link
Member

@mafredri mafredri Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note here that omitempty isn't actually relevant. Since sql.NullTime is a struct, it can't be omitted even when the struct is "zero".

https://go.dev/play/p/SGmN64SRt8F

Omitempty can be relevant in e.g. codersdk when we use codersdk.NullTime that implements MarshalJSON. In that case it might help with generation of TypeScript types (unless we handle the type specifically in gen).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that using format here is wrong, too (it'd be OK for codersdk.NullTime).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafredri sounds like UpdatedAt should be a codersdk.NullTime then in the API struct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah @johnstcn, I think that would be better 👍🏻

Copy link
Member Author

@johnstcn johnstcn Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LastSeenAt NullTime `json:"last_seen_at,omitempty" format:"date-time"`
Name string `json:"name"`
Version string `json:"version,omitempty"`
Version string `json:"version"`
Provisioners []ProvisionerType `json:"provisioners"`
Tags map[string]string `json:"tags"`
}
Expand Down
2 changes: 1 addition & 1 deletion site/src/api/typesGenerated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.