An open API service indexing awesome lists of open source software.

https://github.com/ningenme/miiko-api

趣味開発 compro-api (product name: miiko)
https://github.com/ningenme/miiko-api

connect golang grpc ningenme-project protobuf

Last synced: about 2 months ago
JSON representation

趣味開発 compro-api (product name: miiko)

Awesome Lists containing this project

README

          

# miiko-api

- TODO
- displaynameの自動取得を追加
- 最近updateのあったトピック一覧を出す
- 最近updateのあった問題一覧を出す
- problem deleteに保護 + 作成
- category deleteに保護 + 作成
- topic deleteに保護 + 作成

- カテゴリー一覧を別ページで作る
- topicのupdateの契機を子データにも依存させる
- problem作成時に失敗したらエラーを表示する

- sp確認
- 画面遷移がもっさりしてる

- how to build proto

```shell
cd proto
buf lint
npx buf generate miiko
```

- how to set env-variable

```shell
`aws ssm get-parameters-by-path --path "/" --region ap-northeast-1 --output text | awk '{print "export",$5"="$7}'`
```

## health

```shell
curl -XPOST -H 'Content-Type: application/json' -d '{}' localhost:8081/miiko.v1.HealthService/Check -i
```

## url

```shell
curl -XPOST -H 'Content-Type: application/json' -d '{
"url" : "https://ningenme.net"
}' localhost:8081/miiko.v1.MiikoService/UrlGet -i
```

## statistics

```shell
curl -XPOST -H 'Content-Type: application/json' -d '{
}' localhost:8081/miiko.v1.MiikoService/StatisticsGet -i
```

## category

```shell
curl -XPOST -H 'Content-Type: application/json' -d '
{
"isRequiredTopic": true
}
' localhost:8081/miiko.v1.MiikoService/CategoryListGet -i
curl -XPOST -H 'Content-Type: application/json' -d '
{
"category" : {
"categoryDisplayName": "テスト",
"categorySystemName": "test",
"categoryOrder": 1
}
}
' localhost:8081/miiko.v1.MiikoService/CategoryPost -i
curl -XPOST -H 'Content-Type: application/json' -d '
{
"categoryId" : "category_BKL1Q5",
"category" : {
"categoryDisplayName": "テスト改",
"categorySystemName": "test2",
"categoryOrder": -1
}
}
' localhost:8081/miiko.v1.MiikoService/CategoryPost -i
curl -XPOST -H 'Content-Type: application/json' -d '
{
"categoryId" : "category_BKL1Q5"
}
' localhost:8081/miiko.v1.MiikoService/CategoryPost -i
```

## topic

```shell
curl -XPOST -H 'Content-Type: application/json' -d '
{
"categorySystemName" : "accumulate"
}
' localhost:8081/miiko.v1.MiikoService/TopicListGet -i
curl -XPOST -H 'Content-Type: application/json' -d '
{
"categorySystemName" : "accumulate"
}
' https://miiko-api.ningenme.net/miiko.v1.MiikoService/TopicListGet -i
curl -XPOST -H 'Content-Type: application/json' -d '
{
"topic" : {
"topicDisplayName": "テスト改",
"topicOrder": 10
},
"categoryId" : "category_000021"
}
' -b 'NINGENME_NET_SESSION=<>' localhost:8081/miiko.v1.MiikoService/TopicPost -i
curl -XPOST -H 'Content-Type: application/json' -d '
{
"topicId" : "topic_HMX3VH",
"topic" : {
"topicDisplayName": "テスト改2",
"topicOrder": 10
},
"categoryId" : "category_000021"
}
' -b 'NINGENME_NET_SESSION=<>' localhost:8081/miiko.v1.MiikoService/TopicPost -i
```

## problem

```shell
curl -XPOST -H 'Content-Type: application/json' -d '
{
"limit" : 100,
"offset" : 0,
"isDesc" : true
}
' localhost:8081/miiko.v1.MiikoService/ProblemListGet -i
curl -XPOST -H 'Content-Type: application/json' -d '
{
"problemId" : "problem_000022"
}
' localhost:8081/miiko.v1.MiikoService/ProblemGet -i
curl -XPOST -H 'Content-Type: application/json' -d '
{
"problem" : {
"url" : "https://ningenme.net/piyo",
"problemDisplayName" : "テスト",
"estimation" : 100
}
}
' localhost:8081/miiko.v1.MiikoService/ProblemPost -i
```

```mysql
INSERT INTO topic (topic_id, category_id, topic_display_name, topic_order)
VALUES ('topic_R6J23B', 'category_1J6WNP', 'テスト', 10);
INSERT INTO problem (problem_id, url, problem_display_name, estimation)
VALUES ('problem_R21112', 'https://qiita.com/', 'テスト問題', 100);
INSERT INTO relation_topic_problem (topic_id, problem_id)
VALUES ('topic_R6J23B', 'problem_R21112');
INSERT INTO problem (problem_id, url, problem_display_name, estimation)
VALUES ('problem_R21113', 'https://zenn.dev/', 'テスト問題2', 100);
INSERT INTO relation_topic_problem (topic_id, problem_id)
VALUES ('topic_R6J23B', 'problem_R21113');
```

```mysql
DELETE
FROM category;

INSERT INTO category (category_id, category_display_name, category_system_name, category_order)
SELECT CONCAT('category_', LPAD(CAST(genre_id AS CHAR), 6, '0')) AS category_id,
genre_name AS category_display_name,
path AS category_system_name,
genre_order AS category_order
FROM zz_genre
WHERE deleted_time IS null;
```

```mysql
DELETE
FROM category;

INSERT INTO category (category_id, category_display_name, category_system_name, category_order)
SELECT CONCAT('category_', LPAD(CAST(genre_id AS CHAR), 6, '0')) AS category_id,
genre_name AS category_display_name,
path AS category_system_name,
genre_order AS category_order
FROM zz_genre
WHERE deleted_time IS null;
```

```mysql
DELETE
FROM topic;

INSERT INTO topic (topic_id, category_id, topic_display_name, topic_order)
SELECT CONCAT('topic_', LPAD(CAST(topic_id AS CHAR), 6, '0')) AS topic_id,
CONCAT('category_', LPAD(CAST(genre_id AS CHAR), 6, '0')) AS category_id,
topic_name AS topic_display_name,
topic_order AS topic_order
FROM zz_topic
WHERE deleted_time IS null;
```

```mysql
DELETE
FROM problem;

INSERT IGNORE INTO problem (problem_id, url, problem_display_name, estimation)
SELECT CONCAT('problem_', UPPER(LPAD(CAST(task_id AS CHAR), 6, '0'))) AS problem_id,
url AS url,
task_name AS problem_display_name,
estimation AS estimation
FROM zz_task
WHERE deleted_time IS null;
```

```mysql
INSERT IGNORE INTO relation_topic_problem (topic_id, problem_id)
SELECT CONCAT('topic_', LPAD(CAST(topic_id AS CHAR), 6, '0')) AS topic_id,
CONCAT('problem_', UPPER(LPAD(CAST(task_id AS CHAR), 6, '0'))) AS problem_id
FROM zz_relation_topic_task;
```