Sort employee signatures and approvals by most recently updated

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-04-03 15:56:07 +02:00
parent b610a19b84
commit 2b377a22e7
6 changed files with 14 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ export const employeeApprovalsPageQuery = graphql`
approvableDocuments(
organizationId: $organizationId
first: 1000
orderBy: { field: CREATED_AT, direction: DESC }
orderBy: { field: UPDATED_AT, direction: DESC }
) @required(action: THROW) {
edges @required(action: THROW) {
node @required(action: THROW) {

View File

@@ -28,7 +28,7 @@ export const employeeDocumentsPageQuery = graphql`
signableDocuments(
organizationId: $organizationId
first: 1000
orderBy: { field: CREATED_AT, direction: DESC }
orderBy: { field: UPDATED_AT, direction: DESC }
) @required(action: THROW) {
edges @required(action: THROW) {
node @required(action: THROW) {

View File

@@ -52,6 +52,8 @@ func (p Document) CursorKey(orderBy DocumentOrderField) page.CursorKey {
switch orderBy {
case DocumentOrderFieldCreatedAt:
return page.NewCursorKey(p.ID, p.CreatedAt)
case DocumentOrderFieldUpdatedAt:
return page.NewCursorKey(p.ID, p.UpdatedAt)
case DocumentOrderFieldTitle:
return page.NewCursorKey(p.ID, p.Title)
case DocumentOrderFieldDocumentType:

View File

@@ -22,6 +22,7 @@ type (
const (
DocumentOrderFieldCreatedAt DocumentOrderField = "CREATED_AT"
DocumentOrderFieldUpdatedAt DocumentOrderField = "UPDATED_AT"
DocumentOrderFieldTitle DocumentOrderField = "TITLE"
DocumentOrderFieldDocumentType DocumentOrderField = "DOCUMENT_TYPE"
)
@@ -30,6 +31,8 @@ func (p DocumentOrderField) Column() string {
switch p {
case DocumentOrderFieldCreatedAt:
return "created_at"
case DocumentOrderFieldUpdatedAt:
return "updated_at"
case DocumentOrderFieldTitle:
return "title"
case DocumentOrderFieldDocumentType:
@@ -41,6 +44,7 @@ func (p DocumentOrderField) Column() string {
func (p DocumentOrderField) IsValid() bool {
switch p {
case DocumentOrderFieldCreatedAt,
DocumentOrderFieldUpdatedAt,
DocumentOrderFieldTitle,
DocumentOrderFieldDocumentType:
return true

View File

@@ -542,6 +542,10 @@ enum DocumentOrderField
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.DocumentOrderFieldCreatedAt"
)
UPDATED_AT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.DocumentOrderFieldUpdatedAt"
)
DOCUMENT_TYPE
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.DocumentOrderFieldDocumentType"

View File

@@ -103,6 +103,8 @@ func (d EmployeeDocument) CursorKey(orderBy coredata.DocumentOrderField) page.Cu
switch orderBy {
case coredata.DocumentOrderFieldCreatedAt:
return page.NewCursorKey(d.ID, d.CreatedAt)
case coredata.DocumentOrderFieldUpdatedAt:
return page.NewCursorKey(d.ID, d.UpdatedAt)
case coredata.DocumentOrderFieldTitle:
return page.NewCursorKey(d.ID, d.Title)
case coredata.DocumentOrderFieldDocumentType: