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

Solve #33 - Refactor WIP limit Use Case #40

Merged
merged 5 commits into from
May 10, 2024

Conversation

FelipeGuzmanSierra
Copy link
Collaborator

@FelipeGuzmanSierra FelipeGuzmanSierra commented May 9, 2024

Closes #33

Context

On this PR, the WIP limit notification use case was refactored. For this:

  • A new BOT was added to fetch the WIP counts by domain from a Notion database.
  • A new BOT was added to fetch the WIP limits by domain from a Notion database.
  • A new BOT was added to calculate the domains that have exceeded the limit.
  • A new BOT was added to format the notification message.

Example of use:

connection = {
    host: "localhost",
    port: 5432,
    dbname: "bas",
    user: "postgres",
    password: "postgres"
  }

## FetchDomainsWipCountsFromNotion
  options = {
    process_options: {
      database_id: "notion database id",
      secret: "notion secret"
    },
    write_options: {
      connection:,
      db_table: "use_cases",
      bot_name: "FetchDomainsWipCountsFromNotion"
    }
  }

  Bot::FetchDomainsWipCountsFromNotion.new(options).execute

## FetchDomainsWipLimitFromNotion
  options = {
    read_options: {
      connection:,
      db_table: "use_cases",
      bot_name: "FetchDomainsWipCountsFromNotion"
    },
    process_options: {
      database_id: "notion database id",
      secret: "notion secret"
    },
    write_options: {
      connection:,
      db_table: "use_cases",
      bot_name: "FetchDomainsWipLimitFromNotion"
    }
  }

  Bot::FetchDomainsWipLimitFromNotion.new(options).execute

## CompareWipLimitCount
  options = {
    read_options: {
      connection:,
      db_table: "use_cases",
      bot_name: "FetchDomainsWipLimitFromNotion"
    },
    write_options: {
      connection:,
      db_table: "use_cases",
      bot_name: "CompareWipLimitCount"
    }
  }

  Bot::CompareWipLimitCount.new(options).execute

## FormatWipLimitExceeded
  options = {
    read_options: {
      connection:,
      db_table: "use_cases",
      bot_name: "CompareWipLimitCount"
    },
    process_options: {
      template: ":warning: The <domain> WIP limit was exceeded by <exceeded>"
    },
    write_options: {
      connection:,
      db_table: "use_cases",
      bot_name: "FormatWipLimitExceeded"
    }
  }

  Bot::FormatWipLimitExceeded.new(options).execute

## NotifyDiscord
  options = {
    read_options: {
      connection:,
      db_table: "use_cases",
      bot_name: "FormatWipLimitExceeded"
    },
    process_options: {
      name: "fgsBOT",
      webhook: "discord webhook"
    },
    write_options: {
      connection:,
      db_table: "use_cases",
      bot_name: "NotifyDiscord"
    }
  }

  Bot::NotifyDiscord.new(options).execute

@FelipeGuzmanSierra FelipeGuzmanSierra added the 👍 Feature New feature or request label May 9, 2024
@FelipeGuzmanSierra FelipeGuzmanSierra self-assigned this May 9, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 9024453417

Details

  • 357 of 357 (100.0%) changed or added relevant lines in 8 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 9007750888: 0.0%
Covered Lines: 2032
Relevant Lines: 2032

💛 - Coveralls

@FelipeGuzmanSierra FelipeGuzmanSierra marked this pull request as ready for review May 9, 2024 22:44
@FelipeGuzmanSierra FelipeGuzmanSierra merged commit a857adf into main May 10, 2024
4 checks passed
@FelipeGuzmanSierra FelipeGuzmanSierra deleted the 33-refactor-wip-limit-use-case branch May 10, 2024 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👍 Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor WIP limit Use Case
3 participants