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/25 既存機能のリファクタリング:名言ドメイン #31

Open
wants to merge 48 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6fc6bd6
distraction: #25 プロトタイプのソースコードを.gitignoreフォルダ配下に移動した
hiarc Apr 28, 2021
8a09a01
chore: #25 バイナリファイルはgitに含めない
stomy13 Apr 28, 2021
ceddfcc
refactor: #25 名言と値オブジェクトのドメインをコーディングした
hiarc Apr 28, 2021
621d9a5
refactor: #25 godocを追加した
hiarc Apr 28, 2021
9368980
refactor: #25 Witticismのコンストラクタ作成。インスタンスが生成できることの確認のテスト追加。
stomy13 Apr 28, 2021
8445581
chore: goのバージョンアップ 1.15 to 1.16。go.mod更新。 go testの結果に色をつけるライブラリ追加。
stomy13 Apr 28, 2021
b2ec065
refactor: #25 WitticismIdをUUIDで生成する
stomy13 Apr 28, 2021
3c6bbb8
refactor: #25 発案者の値オブジェクトを実装した
hiarc May 1, 2021
53d67e6
chore: #25 ライブラリの更新によるコメントの削除
hiarc May 1, 2021
99b5512
refactor: #25 名言ドメインのSentence(値オブジェクト)のテストと実装をした
hiarc May 6, 2021
1e85767
refactor: #25 名言の永続化処理を実装した
hiarc May 6, 2021
5f5a83f
chore: #25 保存時のオートフォーマットを有効にした
hiarc May 6, 2021
4ea511a
refactor #25 名言リポジトリのインスタンス化時にインターフェースとして返すようにした
stomy13 May 9, 2021
fc285b8
refactor: #25 ユビキタス言語の変更にともないシーケンス図の文言を変更した
hiarc May 9, 2021
f81ae9d
Merge branch 'refactor/25-既存機能のリファクタリング:名言ドメイン' of https://github.com…
hiarc May 9, 2021
804e113
refactor #25 名言追加のユースケース処理を実装した
stomy13 May 9, 2021
65e2eb7
Merge branch 'refactor/25-既存機能のリファクタリング:名言ドメイン' of https://github.com…
stomy13 May 9, 2021
4d3ea66
refactor #25 名言ファクトリを実装した
stomy13 May 9, 2021
26ec7c6
refactor #25 名言追加のユースケース処理の戻り値を正しくした
stomy13 May 9, 2021
1051b6b
refactor #25 名言追加のコントローラーを実装した
stomy13 May 9, 2021
85089c3
chore #25 名言ドメインモデルのテストエラーを解消
stomy13 May 9, 2021
a831d03
refactor #25 Github Actionsの導入
stomy13 May 9, 2021
f478c10
refactor #25 Github Actionsのテストエラー解消
stomy13 May 9, 2021
975f398
refactor #25 Github Actionsのテストエラー解消
stomy13 May 9, 2021
6a16c5a
refactor #25 Github Actionsのテストエラー解消(defaultのworking-directory追加)
stomy13 May 9, 2021
3f59edc
refactor: #25 名言ドメインのリポジトリーテストを作成した
hiarc May 9, 2021
69925b3
chore: #25 GitHubActionsで使うリポジトリーのテスト環境を用意した
hiarc May 9, 2021
bc7b3f4
chore: #25 SQLファイル名の修正
hiarc May 9, 2021
59fa070
chore: #25 DBの自動テスト用にCIの構成ファイルを修正
hiarc May 12, 2021
2e467f3
chore: #25 READMEにGithubActionsのステータスのバッジを追加した
stomy13 May 12, 2021
51811d7
refactor: #25 バリデーションエラーの実装(WIP)
hiarc May 15, 2021
81e5b71
refactor: #25 バリデーションエラーの実装
stomy13 May 23, 2021
9cdba19
refactor: #25 バリデーションエラーで予約語を使わないようにした
stomy13 May 23, 2021
575f7ca
refactor: #25 JSON解析のエラー処理とテストを実装した
hiarc May 23, 2021
2b83215
refactor: #25 DBのエラー処理とテストを実装した
stomy13 May 23, 2021
5e2a8ca
refactor #25 エラー構造体の型を判定してHTTPレスポンスを返す
hiarc May 23, 2021
51decc5
refactor: #25 interactorのユニットテストを実装した
hiarc May 29, 2021
e76a2bf
refactor: #25 ユニットテストのアサートを追加した
hiarc May 29, 2021
68a9bf7
refactor: #25 mottingサーバーの起動処理を追加した
hiarc May 29, 2021
fc7fa2f
refactor: #25 mottingで使うコンポーネントに依存性を注入した
hiarc Jun 5, 2021
86aa3df
refactor: #25 名言を追加するための処理とサーバーのURLをマッピングした
hiarc Jun 5, 2021
b973f67
chore: GithubActionsのビルドジョブの追加と失敗時通知の共通化
stomy13 Jun 5, 2021
5344b41
chore: ビルドジョブにruns-onがない
stomy13 Jun 5, 2021
b064329
chore: ビルドを失敗させてみる
stomy13 Jun 5, 2021
4ff5465
chore: ビルドを成功させてみる
stomy13 Jun 5, 2021
c453124
refactor: #25 名言の作成処理がユースケース層に書かれていたため、ドメイン層に移動した
hiarc Jun 12, 2021
e7ffd49
Merge branch 'refactor/25-既存機能のリファクタリング:名言ドメイン' of https://github.com…
hiarc Jun 12, 2021
86b0bdd
refactor: #25 ユーザーが追加した名言を取得する処理を実装した
hiarc Jun 12, 2021
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
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: golang-ci
on: [push]
jobs:
build:
defaults:
run:
working-directory: ./backend/motting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.3'
- name: Get dependencies
run: go get -v -t -d ./...
- name: Build
run: go build
test:
needs: build
defaults:
run:
working-directory: ./backend
runs-on: ubuntu-latest
env:
TEST_DB_HOST: 127.0.0.1
services:
motting-db-test:
image: mysql:8.0.15
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: motting
MYSQL_USER: motting
MYSQL_PASSWORD: motting
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.3'
- run: go version
- name: Get dependencies
run: go get -v -t -d ./...
- run: mysql -h $TEST_DB_HOST --port 3306 -u root -proot < ./.devcontainer/docker/mysql/initialize.sql
- run: mysql -h $TEST_DB_HOST --port 3306 -u root -proot < ./.devcontainer/docker/mysql/inittable.sql
- run: go test -v ./...
notify:
if: ${{ always() }}
needs: [build, test]
runs-on: ubuntu-latest
steps:
- name: Discord notification by failure jobs
if: ${{ needs.build.result == 'failure' || needs.test.result == 'failure' }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: 'Github Bot'
DISCORD_AVATAR : https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
GITHUB_ACTIONS_URL : '${{ github.event.repository.url }}/actions/runs/${{ github.run_id }}?check_suite_focus=true'
uses: Ilshidur/[email protected]
with:
args: 'The project {{ EVENT_PAYLOAD.repository.full_name }} has been failed test. {{ GITHUB_ACTIONS_URL }}'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# motting
[![golang-ci](https://github.com/MasatoTokuse/motting/actions/workflows/ci.yml/badge.svg)](https://github.com/MasatoTokuse/motting/actions/workflows/ci.yml)
3 changes: 2 additions & 1 deletion backend/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go"
"golang.Go",
"eriklynd.json-tools"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
Expand Down
4 changes: 3 additions & 1 deletion backend/.devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ services:
context: ./docker/golang
dockerfile: Dockerfile
args:
- VARIANT=1.15
- VARIANT=1.16
- INSTALL_NODE=true
- NODE_VERSION=lts/*
container_name: motting-app
ports:
- 3001:3001
- 3002:3002
env_file:
- ./docker/golang/golang.env
volumes:
- ../:/go/src
working_dir: /go/src
Expand Down
5 changes: 4 additions & 1 deletion backend/.devcontainer/docker/golang/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/l
# RUN go get -x <your-dependency-or-tool>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

# go testの結果に色をつけるライブラリ
RUN go get -u github.com/rakyll/gotest
1 change: 1 addition & 0 deletions backend/.devcontainer/docker/golang/golang.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TEST_DB_HOST=motting-db-test
12 changes: 6 additions & 6 deletions backend/.devcontainer/docker/mysql/inittable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ CREATE TABLE IF NOT EXISTS motting.users (
PRIMARY KEY(id)
);

CREATE TABLE motting.phrases (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
CREATE TABLE motting.witticisms (
`id` varchar(36) NOT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`user_id` varchar(24) DEFAULT NULL,
`text` varchar(128) DEFAULT NULL,
`author` varchar(24) DEFAULT NULL,
`owner_id` varchar(24) DEFAULT NULL,
`sentence` varchar(128) DEFAULT NULL,
`teller_name` varchar(24) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_phrases_deleted_at` (`deleted_at`)
KEY `idx_witticisms_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE motting.push_times (
Expand Down
12 changes: 8 additions & 4 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.go/
keypair.json
__debug_bin
*/var
.go/
keypair.json
__debug_bin
*/var
prototype/*
motting/motting
webpush/webpush
go.sum
3 changes: 2 additions & 1 deletion backend/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"dlvLoadConfig": {
"maxStringLen": 10000,
}
}
},
"editor.formatOnSave": true
}
32 changes: 18 additions & 14 deletions backend/go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
module github.com/MasatoTokuse/motting

go 1.13
go 1.16

require (
github.com/SherClockHolmes/webpush-go v1.1.0
github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607 // indirect
github.com/go-chi/chi v4.0.3+incompatible
github.com/go-chi/cors v1.0.0
github.com/gorilla/sessions v1.2.0
github.com/jinzhu/gorm v1.9.12
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/spf13/cobra v0.0.6
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.4.0
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd
golang.org/x/tools/gopls v0.3.3 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 // indirect
github.com/coreos/go-etcd v2.0.0+incompatible // indirect
github.com/cpuguy83/go-md2man v1.0.10 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-chi/chi v1.5.4 // indirect
github.com/go-chi/cors v1.2.0 // indirect
github.com/google/uuid v1.2.0
github.com/kr/pretty v0.1.0 // indirect
github.com/spf13/cobra v1.1.3 // indirect
github.com/spf13/viper v1.7.1 // indirect
github.com/stretchr/testify v1.7.0
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 // indirect
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gorm.io/driver/mysql v1.1.0 // indirect
gorm.io/gorm v1.21.10
)
Loading