Skip to content

Commit

Permalink
Merge pull request #565 from narumincho/dev
Browse files Browse the repository at this point in the history
TOTPでの新規作成
  • Loading branch information
narumincho authored Jan 22, 2024
2 parents c27fc4b + f9b0fe1 commit 995e6f3
Show file tree
Hide file tree
Showing 32 changed files with 2,795 additions and 573 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy_to_cloudflare_pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
cache: true
- run: flutter build web
- run: flutter build web --dart-define=ORIGIN=https://definy.deno.dev
- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@1
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
projectName: definy
directory: ./build/web/
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ app.*.map.json

/.fvm/flutter_sdk
/script/startInLocal.ts
/local.sqlite*
4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"--inspect",
"--check",
"--unstable",
"--allow-net=:8000"
"--allow-net=:8000",
"--allow-read=local.sqlite*",
"--allow-write=local.sqlite*"
],
"program": "${workspaceFolder}/script/startInLocal.ts",
"attachSimplePort": 9229
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ deno run --check --allow-env --allow-net --allow-read --allow-write=./dist.json
fvm flutter pub run ./lib/codegen.dart && fvm dart fix --apply && fvm dart format .
```

### step 1 api gen
### step 2 api gen

```sh
fvm flutter pub run ./lib/codegen_api.dart && fvm dart fix --apply && fvm dart format .
Expand All @@ -54,7 +54,9 @@ deno run --allow-run --allow-read ./script/typeCheck.ts

## フォルダとファイルの説明

- `/.github/workflows/pull_request.yml`: Pull Request
- `.github/workflows/pull_request.yml`: Pull Request
したときに実行されるテストの処理が書かれている
- `/.vscode`: VSCode 向けの設定
- `/assets`: スタティックなファイルが置かれている
- `.vscode`: VSCode 向けの設定
- `assets`: スタティックなファイルが置かれている
- `local.sqlite`, `local.sqlite-shm`, `local.sqlite-wal`
ローカルで開発するときに使うデータベースのファイル
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ linter:
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_parenthesis
- unnecessary_raw_strings
- use_colored_box
Expand Down
5 changes: 5 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/codegen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'dart:io';

// ignore: depend_on_referenced_packages
import 'package:simple_dart_code_gen/simple_dart_code_gen.dart';
import 'package:simple_graphql_client_gen/simple_graphql_client_gen.dart';

Expand Down
69 changes: 61 additions & 8 deletions lib/codegen_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,74 @@ import 'dart:io';

import 'package:definy/graphql/query.dart' as query;
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
// ignore: depend_on_referenced_packages
import 'package:simple_dart_code_gen/simple_dart_code_gen.dart';
import 'package:simple_graphql_client_gen/query_string.dart';
import 'package:simple_graphql_client_gen/simple_graphql_client_gen.dart';

const IMap<String, GraphQLRootObject> _apiMap = IMapConst({
'accountByCode': query.Query(
name: 'QueryAccountByCode',
IListConst([
query.Query_accountByCode(
code: Variable('code'),
query.Account(IListConst([
query.Account_id(),
])),
'QueryAccountByCode',
IMapConst({}),
accountByCode: query.Query_accountByCode(
code: Variable('code'),
query.Account(
'AccountOnlyId',
IMapConst({}),
id: query.Account_id(),
),
]),
),
),
'createTotpKey': query.Mutation(
'MutationCreateTotpKey',
IMapConst({}),
createTotpKey: query.Mutation_createTotpKey(query.TotpKeyAndId(
'TotpKey',
IMapConst({}),
id: query.TotpKeyAndId_id(),
secret: query.TotpKeyAndId_secret(),
)),
),
'createAccount': query.Mutation(
'QueryCreateAccount',
IMapConst({}),
createAccount: query.Mutation_createAccount(
totpCode: Variable('totpCode'),
accountCode: Variable('accountCode'),
totpKeyId: Variable('totpKeyId'),
displayName: Variable('displayName'),
query.CreateAccountResult(
createAccountDuplicateCode: query.CreateAccountDuplicateCode(
'CreateAccountDuplicateCode',
IMapConst({}),
accountCode: query.CreateAccountDuplicateCode_accountCode(),
),
createAccountInvalidCode: query.CreateAccountInvalidCode(
'CreateAccountInvalidCode',
IMapConst({}),
accountCode: query.CreateAccountInvalidCode_accountCode(),
),
createAccountNotFoundTotpKeyId: query.CreateAccountNotFoundTotpKeyId(
'CreateAccountNotFoundTotpKeyId',
IMapConst({}),
keyId: query.CreateAccountNotFoundTotpKeyId_keyId(),
),
createAccountResultOk: query.CreateAccountResultOk(
'CreateAccountResultOk',
IMapConst({}),
account: query.CreateAccountResultOk_account(
query.Account(
'Account',
IMapConst({}),
id: query.Account_id(),
code: query.Account_code(),
createDateTime: query.Account_createDateTime(),
displayName: query.Account_displayName(),
),
),
),
),
),
),
});

Expand Down
6 changes: 6 additions & 0 deletions lib/env.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// ignore_for_file: do_not_use_environment

const origin =
String.fromEnvironment('ORIGIN', defaultValue: 'http://localhost:8080');

final originUri = Uri.parse(origin);
Loading

0 comments on commit 995e6f3

Please sign in to comment.