Sort employee signatures and approvals by most recently updated
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user