-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into MAIN-B-22661
- Loading branch information
Showing
86 changed files
with
3,860 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
migrations/app/schema/20250123210535_update_re_intl_transit_times_for_ak_hhg.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
UPDATE re_intl_transit_times | ||
SET hhg_transit_time = 10 | ||
WHERE origin_rate_area_id IN ('b80a00d4-f829-4051-961a-b8945c62c37d','5a27e806-21d4-4672-aa5e-29518f10c0aa') | ||
OR destination_rate_area_id IN ('b80a00d4-f829-4051-961a-b8945c62c37d','5a27e806-21d4-4672-aa5e-29518f10c0aa'); | ||
|
||
update re_intl_transit_times | ||
SET hhg_transit_time = 20 | ||
WHERE origin_rate_area_id IN ('9bb87311-1b29-4f29-8561-8a4c795654d4','635e4b79-342c-4cfc-8069-39c408a2decd') | ||
OR destination_rate_area_id IN ('9bb87311-1b29-4f29-8561-8a4c795654d4','635e4b79-342c-4cfc-8069-39c408a2decd'); |
25 changes: 25 additions & 0 deletions
25
migrations/app/schema/20250207153450_add_fetch_documents_func.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
CREATE OR REPLACE FUNCTION public.fetch_documents(docCursor refcursor, useruploadCursor refcursor, uploadCursor refcursor, _docID uuid) RETURNS setof refcursor AS $$ | ||
BEGIN | ||
OPEN $1 FOR | ||
SELECT documents.created_at, documents.deleted_at, documents.id, documents.service_member_id, documents.updated_at | ||
FROM documents AS documents | ||
WHERE documents.id = _docID and documents.deleted_at is null | ||
LIMIT 1; | ||
RETURN NEXT $1; | ||
OPEN $2 FOR | ||
SELECT user_uploads.created_at, user_uploads.deleted_at, user_uploads.document_id, user_uploads.id, user_uploads.updated_at, | ||
user_uploads.upload_id, user_uploads.uploader_id | ||
FROM user_uploads AS user_uploads | ||
WHERE user_uploads.deleted_at is null and user_uploads.document_id = _docID | ||
ORDER BY created_at asc; | ||
RETURN NEXT $2; | ||
OPEN $3 FOR | ||
SELECT uploads.id, uploads.bytes, uploads.checksum, uploads.content_type, uploads.created_at, uploads.deleted_at, uploads.filename, | ||
uploads.rotation, uploads.storage_key, uploads.updated_at, uploads.upload_type | ||
FROM uploads AS uploads, user_uploads | ||
WHERE uploads.deleted_at is null | ||
and uploads.id = user_uploads.upload_id | ||
and user_uploads.deleted_at is null and user_uploads.document_id = _docID; | ||
RETURN NEXT $3; | ||
END; | ||
$$ LANGUAGE plpgsql; |
22 changes: 22 additions & 0 deletions
22
migrations/app/schema/20250213151815_fix_spacing_fetch_documents.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE OR REPLACE FUNCTION public.fetch_documents(docCursor refcursor, useruploadCursor refcursor, uploadCursor refcursor, _docID uuid) RETURNS setof refcursor AS $$ | ||
BEGIN | ||
OPEN $1 FOR | ||
SELECT documents.created_at, documents.deleted_at, documents.id, documents.service_member_id, documents.updated_at | ||
FROM documents AS documents | ||
WHERE documents.id = _docID and documents.deleted_at is null | ||
LIMIT 1; | ||
RETURN NEXT $1; | ||
OPEN $2 FOR | ||
SELECT user_uploads.created_at, user_uploads.deleted_at, user_uploads.document_id, user_uploads.id, user_uploads.updated_at, | ||
user_uploads.upload_id, user_uploads.uploader_id | ||
FROM user_uploads AS user_uploads | ||
WHERE user_uploads.deleted_at is null and user_uploads.document_id = _docID | ||
ORDER BY created_at asc; | ||
RETURN NEXT $2; | ||
OPEN $3 FOR | ||
SELECT uploads.id, uploads.bytes, uploads.checksum, uploads.content_type, uploads.created_at, uploads.deleted_at, uploads.filename, | ||
uploads.rotation, uploads.storage_key, uploads.updated_at, uploads.upload_type FROM uploads AS uploads , user_uploads | ||
WHERE uploads.deleted_at is null and uploads.id = user_uploads.upload_id and user_uploads.deleted_at is null and user_uploads.document_id = _docID; | ||
RETURN NEXT $3; | ||
END; | ||
$$ LANGUAGE plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/pflag" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
const ( | ||
// ReceiverBackendFlag is the Receiver Backend Flag | ||
ReceiverBackendFlag string = "receiver-backend" | ||
// SNSTagsUpdatedTopicFlag is the SNS Tags Updated Topic Flag | ||
SNSTagsUpdatedTopicFlag string = "sns-tags-updated-topic" | ||
// SNSRegionFlag is the SNS Region flag | ||
SNSRegionFlag string = "sns-region" | ||
// SNSAccountId is the application's AWS account id | ||
SNSAccountId string = "aws-account-id" | ||
// ReceiverCleanupOnStartFlag is the Receiver Cleanup On Start Flag | ||
ReceiverCleanupOnStartFlag string = "receiver-cleanup-on-start" | ||
) | ||
|
||
// InitReceiverFlags initializes Storage command line flags | ||
func InitReceiverFlags(flag *pflag.FlagSet) { | ||
flag.String(ReceiverBackendFlag, "local", "Receiver backend to use, either local or sns_sqs.") | ||
flag.String(SNSTagsUpdatedTopicFlag, "", "SNS Topic for receiving event messages") | ||
flag.String(SNSRegionFlag, "", "Region used for SNS and SQS") | ||
flag.String(SNSAccountId, "", "SNS account Id") | ||
flag.Bool(ReceiverCleanupOnStartFlag, false, "Receiver will cleanup previous aws artifacts on start.") | ||
} | ||
|
||
// CheckReceiver validates Storage command line flags | ||
func CheckReceiver(v *viper.Viper) error { | ||
|
||
receiverBackend := v.GetString(ReceiverBackendFlag) | ||
if !stringSliceContains([]string{"local", "sns_sqs"}, receiverBackend) { | ||
return fmt.Errorf("invalid receiver_backend %s, expecting local or sns_sqs", receiverBackend) | ||
} | ||
|
||
receiverCleanupOnStart := v.GetString(ReceiverCleanupOnStartFlag) | ||
if !stringSliceContains([]string{"true", "false"}, receiverCleanupOnStart) { | ||
return fmt.Errorf("invalid receiver_cleanup_on_start %s, expecting true or false", receiverCleanupOnStart) | ||
} | ||
|
||
if receiverBackend == "sns_sqs" { | ||
r := v.GetString(SNSRegionFlag) | ||
if r == "" { | ||
return fmt.Errorf("invalid value for %s: %s", SNSRegionFlag, r) | ||
} | ||
topic := v.GetString(SNSTagsUpdatedTopicFlag) | ||
if topic == "" { | ||
return fmt.Errorf("invalid value for %s: %s", SNSTagsUpdatedTopicFlag, topic) | ||
} | ||
accountId := v.GetString(SNSAccountId) | ||
if topic == "" { | ||
return fmt.Errorf("invalid value for %s: %s", SNSAccountId, accountId) | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package cli | ||
|
||
func (suite *cliTestSuite) TestConfigReceiver() { | ||
suite.Setup(InitReceiverFlags, []string{}) | ||
suite.NoError(CheckReceiver(suite.viper)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.