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

Refactor/aws integration #100

Merged
merged 18 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3424d9f
feat:added upload middleware; added route to test file upload to s3;
Manjish Feb 26, 2024
3ae61c8
feat: added cognito auth middleware
Manjish Feb 26, 2024
e4458d5
feat: added admin seed; changes in user model; added auto migration u…
Manjish Feb 26, 2024
c01e188
refactor:made auto-migrate optional
Manjish Feb 26, 2024
b07b345
feat:sending simple email using Amazon SES
Manjish Feb 26, 2024
2de07ae
:wrench: chore: remove gcp and firebase related services
paudelgaurav Jun 6, 2024
514d870
:sparkles: feat: added atlas as migation tool
paudelgaurav Jun 6, 2024
02d6fd0
:wrench: chore: merge branch develop into refactor/enhancement-aws-in…
paudelgaurav Jun 6, 2024
b21b15e
:wrench: chore: update go version to 1.22 in workflow file
paudelgaurav Jun 6, 2024
1d4db2c
:wrench: chore: running migration in github runner
paudelgaurav Jun 6, 2024
bfc8f90
:wrench: chore: downloading atlas in github runner
paudelgaurav Jun 6, 2024
da39f7b
:wrench: chore: remove env flag while applying migration
paudelgaurav Jun 6, 2024
c95f131
:wrench: chore: remove apply migration in runner
paudelgaurav Jun 6, 2024
aea044b
:wrench: chore: fix command to serve and check health
paudelgaurav Jun 6, 2024
ace0efd
:wrench: chore: fix command to migrate
paudelgaurav Jun 6, 2024
f6ec64e
:hammer: updated make file for migrating to previous version
Denes-cilwal Jun 7, 2024
a849067
:hammer: added port forward in env
Denes-cilwal Jun 7, 2024
16da18e
Merge pull request #114 from wesionaryTEAM/refactor/enhancement-in-aw…
Denes-cilwal Jun 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion domain/user/module.go
Copy link
Contributor

Choose a reason for hiding this comment

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

@Manjish Let's remove this as auto migrate invocation and stick to writing migration for schema.

Copy link
Member

Choose a reason for hiding this comment

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

will be fixed by #114

Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ var Module = fx.Module("user",
NewController,
NewRoute,
),
fx.Invoke(Migrate, RegisterRoute),
//If you want to enable auto-migrate add Migrate as shown below
// fx.Invoke(Migrate, RegisterRoute),

fx.Invoke(RegisterRoute),
))
1 change: 1 addition & 0 deletions domain/user/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func NewRepository(db infrastructure.Database, logger framework.Logger) Reposito
return Repository{db, logger}
}

// For AutoMigrating (used in fx.Invoke)
func Migrate(r Repository) error {
r.logger.Info("[Migrating...User]")
if err := r.DB.AutoMigrate(&models.User{}); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let revert these changes ! @Manjish

Copy link
Member

Choose a reason for hiding this comment

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

will be fixed by #114

Expand Down
29 changes: 19 additions & 10 deletions migration/20210421032843-create_users_table.sql
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@

-- +migrate Up
CREATE TABLE IF NOT EXISTS `users` (
`id` BINARY(16) NOT NULL,
`email` VARCHAR(100) NOT NULL,
`name` VARCHAR(20) NOT NULL,
`age` int(10) UNSIGNED,
`birthday` DATETIME,
`profile_pic` VARCHAR(100),
`member_number` VARCHAR(100),
`id` bigint unsigned AUTO_INCREMENT PRIMARY KEY,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT email_unique UNIQUE(email)
)ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
`deleted_at` DATETIME NULL,
`uuid` BINARY(16) NOT NULL,
`cognito_uid` VARCHAR(50) NULL,
`first_name` VARCHAR(255) NOT NULL,
`last_name` VARCHAR(255) NOT NULL,
`first_name_ja` VARCHAR(255) NOT NULL,
`last_name_ja` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) NOT NULL UNIQUE,
`role` VARCHAR(25) NOT NULL,
`is_active` BOOLEAN NOT NULL DEFAULT false,
`is_email_verified` BOOLEAN NOT NULL DEFAULT false,
`is_admin` BOOLEAN NOT NULL DEFAULT false,
`profile_pic` text NOT NULL,
INDEX `idx_users_uuid` (`uuid`),
INDEX `idx_users_cognito_uid` (`cognito_uid`),
INDEX `idx_users_email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


-- +migrate Down
DROP TABLE IF EXISTS `users`;