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

Implement liquidation for a specific period #20

Merged
merged 8 commits into from
Aug 6, 2023
Merged

Implement liquidation for a specific period #20

merged 8 commits into from
Aug 6, 2023

Conversation

raahii
Copy link
Contributor

@raahii raahii commented Jun 24, 2023

resolve #19

Changes

sequence

AS-IS

既存の清算シナリオは「清算→清算額計算→清算完了」で、全期間での清算、すなわち合計支払額の不均衡を解消することしかできない。
この清算では、各ユーザーの支払い合計額を payAmount で保持しているのでそれを使っている。

CHANGE-TO

AS-ISの清算シナリオに1ステップ追加し、期間を指定できるようにする。「清算→期間選択→清算額計算→清算完了」。
この場合、指定された期間内に起こった支払いのみを清算する。

個々の支払いの履歴が必要となるため、payments collectionを今回追加する。

期間の入力にはわかりやすさのため 日時選択アクション を使用する。postback dataの保存が必要のため新たにstoreにliquidations collectionを用意する。

Limitation

  • payments collectionを使り始めたのが 2023/06/23 〜なので、ユーザーが選択できる期間はそれ以降

Refactoring

  • flex message packageの作成
    • 標準のテンプレートであっても flex message で自作する方がデザイン性が良く、数が増えたため
  • 清算を evenUp から liquidation に変更(が、めっちゃタイポする)
  • storeのコードのファイル分割

Future Works

@raahii raahii self-assigned this Jun 24, 2023
@raahii raahii changed the title Implement liquidation for a specified period Implement liquidation for a specific period Jun 24, 2023
@github-actions
Copy link

github-actions bot commented Aug 6, 2023

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan
data.archive_file.bot: Reading...
google_storage_bucket.bucket: Refreshing state... [id=haraiai-bucket]
data.google_secret_manager_secret_version.line_bot_channel_secret: Reading...
data.google_secret_manager_secret_version.line_bot_channel_access_token: Reading...
data.archive_file.bot: Read complete after 1s [id=25521f4b8e0fc26b87decc1f7c4df021093e964c]
google_storage_bucket_object.bot: Refreshing state... [id=haraiai-bucket-func/bot.8333501175c898323f3d2a5aeb02d6f7.zip]
data.google_secret_manager_secret_version.line_bot_channel_access_token: Read complete after 0s [id=projects/900543910035/secrets/lineBotChannelAccessToken/versions/1]
data.google_secret_manager_secret_version.line_bot_channel_secret: Read complete after 1s [id=projects/900543910035/secrets/lineBotChannelSecret/versions/1]
google_cloudfunctions_function.bot_webhook: Refreshing state... [id=projects/haraiai/locations/asia-northeast1/functions/BotWebhookHandler]
google_cloudfunctions_function_iam_member.webhook_invoker: Refreshing state... [id=projects/haraiai/locations/asia-northeast1/functions/BotWebhookHandler/roles/cloudfunctions.invoker/allUsers]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # google_cloudfunctions_function.bot_webhook will be updated in-place
  ~ resource "google_cloudfunctions_function" "bot_webhook" {
        id                           = "projects/haraiai/locations/asia-northeast1/functions/BotWebhookHandler"
        name                         = "BotWebhookHandler"
      ~ source_archive_object        = "func/bot.8333501175c898323f3d2a5aeb02d6f7.zip" -> "func/bot.87de9d242992f7c315cd785ab56b7276.zip"
        # (19 unchanged attributes hidden)
    }

  # google_storage_bucket_object.bot must be replaced
-/+ resource "google_storage_bucket_object" "bot" {
      ~ content_type     = "application/zip" -> (known after apply)
      ~ crc32c           = "WJuVLA==" -> (known after apply)
      ~ detect_md5hash   = "gzNQEXXImDI/PSpa6wLW9w==" -> "different hash" # forces replacement
      - event_based_hold = false -> null
      ~ id               = "haraiai-bucket-func/bot.8333501175c898323f3d2a5aeb02d6f7.zip" -> (known after apply)
      + kms_key_name     = (known after apply)
      ~ md5hash          = "gzNQEXXImDI/PSpa6wLW9w==" -> (known after apply)
      ~ media_link       = "https://storage.googleapis.com/download/storage/v1/b/haraiai-bucket/o/func%2Fbot.8333501175c898323f3d2a5aeb02d6f7.zip?generation=1687182203112530&alt=media" -> (known after apply)
      - metadata         = {} -> null
      ~ name             = "func/bot.8333501175c898323f3d2a5aeb02d6f7.zip" -> "func/bot.87de9d242992f7c315cd785ab56b7276.zip" # forces replacement
      ~ output_name      = "func/bot.8333501175c898323f3d2a5aeb02d6f7.zip" -> (known after apply)
      ~ self_link        = "https://www.googleapis.com/storage/v1/b/haraiai-bucket/o/func%2Fbot.8333501175c898323f3d2a5aeb02d6f7.zip" -> (known after apply)
      ~ storage_class    = "STANDARD" -> (known after apply)
      - temporary_hold   = false -> null
        # (2 unchanged attributes hidden)
    }

Plan: 1 to add, 1 to change, 1 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

Pushed by: @raahii, Action: pull_request

@pocket-dan pocket-dan deleted a comment from github-actions bot Aug 6, 2023
@pocket-dan pocket-dan deleted a comment from github-actions bot Aug 6, 2023
@github-actions
Copy link

github-actions bot commented Aug 6, 2023

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan
data.archive_file.bot: Reading...
data.google_secret_manager_secret_version.line_bot_channel_secret: Reading...
google_storage_bucket.bucket: Refreshing state... [id=haraiai-bucket]
data.google_secret_manager_secret_version.line_bot_channel_access_token: Reading...
data.archive_file.bot: Read complete after 1s [id=70d0f0a7506c647ab25a7060c96c410c5f981592]
google_storage_bucket_object.bot: Refreshing state... [id=haraiai-bucket-func/bot.8333501175c898323f3d2a5aeb02d6f7.zip]
data.google_secret_manager_secret_version.line_bot_channel_secret: Read complete after 1s [id=projects/900543910035/secrets/lineBotChannelSecret/versions/1]
data.google_secret_manager_secret_version.line_bot_channel_access_token: Read complete after 1s [id=projects/900543910035/secrets/lineBotChannelAccessToken/versions/1]
google_cloudfunctions_function.bot_webhook: Refreshing state... [id=projects/haraiai/locations/asia-northeast1/functions/BotWebhookHandler]
google_cloudfunctions_function_iam_member.webhook_invoker: Refreshing state... [id=projects/haraiai/locations/asia-northeast1/functions/BotWebhookHandler/roles/cloudfunctions.invoker/allUsers]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # google_cloudfunctions_function.bot_webhook will be updated in-place
  ~ resource "google_cloudfunctions_function" "bot_webhook" {
        id                           = "projects/haraiai/locations/asia-northeast1/functions/BotWebhookHandler"
        name                         = "BotWebhookHandler"
      ~ source_archive_object        = "func/bot.8333501175c898323f3d2a5aeb02d6f7.zip" -> "func/bot.8efbd14635d0602158c3202cdff38502.zip"
        # (19 unchanged attributes hidden)
    }

  # google_storage_bucket_object.bot must be replaced
-/+ resource "google_storage_bucket_object" "bot" {
      ~ content_type     = "application/zip" -> (known after apply)
      ~ crc32c           = "WJuVLA==" -> (known after apply)
      ~ detect_md5hash   = "gzNQEXXImDI/PSpa6wLW9w==" -> "different hash" # forces replacement
      - event_based_hold = false -> null
      ~ id               = "haraiai-bucket-func/bot.8333501175c898323f3d2a5aeb02d6f7.zip" -> (known after apply)
      + kms_key_name     = (known after apply)
      ~ md5hash          = "gzNQEXXImDI/PSpa6wLW9w==" -> (known after apply)
      ~ media_link       = "https://storage.googleapis.com/download/storage/v1/b/haraiai-bucket/o/func%2Fbot.8333501175c898323f3d2a5aeb02d6f7.zip?generation=1687182203112530&alt=media" -> (known after apply)
      - metadata         = {} -> null
      ~ name             = "func/bot.8333501175c898323f3d2a5aeb02d6f7.zip" -> "func/bot.8efbd14635d0602158c3202cdff38502.zip" # forces replacement
      ~ output_name      = "func/bot.8333501175c898323f3d2a5aeb02d6f7.zip" -> (known after apply)
      ~ self_link        = "https://www.googleapis.com/storage/v1/b/haraiai-bucket/o/func%2Fbot.8333501175c898323f3d2a5aeb02d6f7.zip" -> (known after apply)
      ~ storage_class    = "STANDARD" -> (known after apply)
      - temporary_hold   = false -> null
        # (2 unchanged attributes hidden)
    }

Plan: 1 to add, 1 to change, 1 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

Pushed by: @raahii, Action: pull_request

@raahii raahii merged commit 73f1e13 into main Aug 6, 2023
4 checks passed
@raahii raahii deleted the polish-even-up branch August 6, 2023 15:20
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.

特定期間に絞った清算
1 participant