Skip to content
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

Update records with datastore.update when advancing rotations #10

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

zimeg
Copy link
Member

@zimeg zimeg commented Mar 21, 2023

Type of change

  • New sample
  • New feature
  • Bug fix
  • Documentation

Summary

To showcase a new datastore operation, this PR replaces the datastore.put call in the advance_rotation function with datastore.update. With this call, only the fields passed into this function will be updated with the primary key channel, while those unspecified are not modified.

The versions of Deno modules were also bumped to support this new function.

Testing

To verify the changes of this PR manually, install this app to a workspace and create a rotation with more than one user.

Then create a trigger with the following definition to force a rotation, and trip this trigger:

import { Trigger } from "deno-slack-api/types.ts";
import AdvanceRotationWorkflow from "../workflows/advance_rotation.ts";

const advanceRotationTrigger: Trigger<
  typeof AdvanceRotationWorkflow.definition
> = {
  type: "shortcut",
  name: "Advance rotation",
  description: "Forcibly advance the rotation",
  workflow: "#/workflows/advance_rotation",
  inputs: {
    channel: {
      value: "{{data.channel_id}}",
    },
  },
};

export default advanceRotationTrigger;

Requirements

  • I’ve checked my submission against the Samples Checklist to ensure it complies with all standards
  • I have ensured the changes I am contributing align with existing patterns and have tested and linted my code
  • I've read and agree to the Code of Conduct

@zimeg
Copy link
Member Author

zimeg commented Mar 21, 2023

FYI: To appease the type checker, I had to merge the changes from #8 into this branch.

Copy link
Contributor

@hello-ashleyintech hello-ashleyintech left a comment

Choose a reason for hiding this comment

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

Tested this and it's looking great! 🎉 (Also thanks for including a link trigger to test the advancing of the rotations! 🙌)

A few thoughts before merging:

Let me know if there are any questions with this!

@filmaj
Copy link
Contributor

filmaj commented Mar 22, 2023

#8 merged in first, or incorporated into this, both seem good. But definitely get the changes from #8 in! Those are key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants