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

READMEを更新 #167

Merged
merged 4 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
64 changes: 29 additions & 35 deletions Documents/API.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# API
API is provided by Firebase Cloud Functions. Database is provided by Firestore.
## UserData
### Create User Data
APIは[Cloud Functions for Firebase](https://firebase.google.com/docs/functions?hl=ja)を使用し、データベースは[Cloud Firestore](https://firebase.google.com/docs/firestore?hl=ja)を使用しています。
## ユーザーデータ
### ユーザーデータを作成
- URL: /user
- Method: POST
- Request
Expand Down Expand Up @@ -31,10 +31,9 @@ API is provided by Firebase Cloud Functions. Database is provided by Firestore.
"streak": 2,
}
```
UserId is hash string generated by Firebase and saved as its document id.
UserIdはFirebaseによって生成されたハッシュ文字列であり、ドキュメントIDとして保存されます。

### Get User
#### Get User by User Id
### ユーザーデータを取得
- URL: /user/id/:userId
- Method: GET
- Response
Expand All @@ -48,13 +47,7 @@ API is provided by Firebase Cloud Functions. Database is provided by Firestore.
}
```

#### Get User by User Name
- URL: /user/name/:userName
- Method: GET
- Response
the same as Get User by User Id

### Update User Data
### ユーザーデータを更新
- URL: /user/:userId
- Method: PUT
- Request
Expand All @@ -64,12 +57,12 @@ API is provided by Firebase Cloud Functions. Database is provided by Firestore.
- name?: string
- fcmToken?: string

### Delete User Data
### ユーザーデータを削除
- URL: /user/:userId
- Method: DELETE

## Goal
### Create Goal
## 目標
### 目標を作成
- URL: /goal
- Method: POST
- Request
Expand All @@ -95,8 +88,8 @@ API is provided by Firebase Cloud Functions. Database is provided by Firestore.
}
```

### Get Goal
- URL: /goal/:goalId
### 目標を取得
- URL: /goal/:userId
- Method: GET
- Response
```json
Expand Down Expand Up @@ -126,7 +119,7 @@ API is provided by Firebase Cloud Functions. Database is provided by Firestore.
]
```

### Update Goal
### 目標を更新
- URL: /goal/:goalId
- Method: PUT
- Request
Expand All @@ -137,12 +130,12 @@ API is provided by Firebase Cloud Functions. Database is provided by Firestore.
- deadline?: Date
- text?: string

### Delete Goal
### 目標を削除
- URL: /goal/:goalId
- Method: DELETE

## Post
### Create Post
## 目標完了投稿
### 投稿を作成
- URL: /post
- Method: POST
- Request
Expand Down Expand Up @@ -170,9 +163,9 @@ API is provided by Firebase Cloud Functions. Database is provided by Firestore.
"postId": "mCKHSiUXRESoZhrUFvw6"
}
```
imageUrl is the URL of the uploaded image.
storedIdはアップロードされた画像のIdです。

### Get Post
### 投稿を取得
- URL: /post/:userId
- Method: GET
- Response
Expand All @@ -189,22 +182,22 @@ API is provided by Firebase Cloud Functions. Database is provided by Firestore.
]
```

### Update Post
Use Create Post API to update post.
### 投稿を更新
投稿を作成するAPIを使用して更新

### Delete Post
### 目標を削除
- URL: /post/:postId
- Method: DELETE

## Result
### Get Result
- URL: /result/:?userId
## 結果
### 結果を取得
- URL: /result/:userId
- Empty userId will return all results.
- Parameters
- limit?: number - The maximum number of results to return. (Default is 50, successはlimit分取得し、そこに追加でfailedを取得する形になる)
- offset?: number - The number of results to skip before starting to collect the result set.
- onlyPending?: boolean - If true, only pending goals will be returned. (Default is false)
- onlyCompleted?: boolean - If true, only completed or failed goals will be returned. (Default is false)
- limit?: number - デフォルトは50, onlyFinishedの場合はsuccessはlimit分取得し、そこに追加でfailedを取得する形になる
- offset?: number
- onlyPending?: boolean - デフォルトはfalse, trueの場合は未完了の目標のみ取得
- onlyFinished?: boolean - デフォルトはfalse, trueの場合は完了・失敗した目標のみ取得
- Method: GET
- Response
```json
Expand Down Expand Up @@ -259,7 +252,8 @@ Use Create Post API to update post.
}
```

## Reactions
## リアクション
### リアクションを作成・更新
- URL: /reaction/:goalId
- Method: PUT
- Request
Expand Down
3 changes: 2 additions & 1 deletion Documents/Database.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
データベースには`user`と`goal`の2つのコレクションがあります。`user`コレクションにはユーザーの情報が、`goal`コレクションにはユーザーが設定した目標と結果の情報が保存されます。
データベースには`user`と`goal`の2つのコレクションがあります。
`user`コレクションにはユーザーの情報が、`goal`コレクションにはユーザーが設定した目標と結果の情報が保存されます。

# userコレクション
user (コレクション)
Expand Down
70 changes: 30 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,50 @@
# About This Project
TODO REAL is a web application that helps users manage their goals and tasks more effectively. It also works as a social platform, allowing users to share their to-do lists with others. By sending notifications and competing with friends, it makes achieving goals more engaging and easier.
This project is developed using Next.js, Firebase, and TypeScript.
For More information, please refer to the Top Page.
[TODO REAL](https://todo-real-c28fa.web.app/)
# TODO REALとは
TODO REALは、TODOリストをSNSのように共有できるようにすることで、目標やタスクの達成を効果的かつ継続的にサポートするWebアプリケーションです。
<p align="center">
<img src="https://github.com/user-attachments/assets/3f4aea01-ef49-43ac-af95-62d9e61a61ff" alt="画像の説明" width="500">
</p>
アプリの使用方法や特徴、詳細については、トップページを参照してください。

## Getting Started
Run the development server:
[TODO REAL トップページ](https://todo-real-c28fa.web.app/)

```bash
npm run dev
```
This includes `npm i` and `next dev`, so you don't have to care about refreshing packages.

## Learn More
To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

## Before using Firebase Emulator
```
npm install -g firebase-tools
```
# ローカルで開発する手順
開発にはFirebaseプロジェクトもしくは権原が必要です。
## フロントエンドを起動

## Emulate in local
### Frontend
```
```bash
npm run dev
```
このコマンドは`npm i`と`next dev`を含んでいます。
Next.jsに関しては[公式サイト](https://nextjs.org/learn)や[公式ドキュメント](https://nextjs.org/docs)を参照してください。

### Backend
Before using Firebase Emulator, you need to login to Firebase.
## バックエンドを起動
初回のみ以下のコマンドを実行
```
npm install -g firebase-tools
firebase login
```

Then, you can start the emulator by running the following command if you have access to this project:
エミュレーターを起動(ローカルでは認証やデータベース、API等全てのサーバーサイドの機能をエミュレーターで実行します。)
```
cd .\functions\
npm run emu
```
This command includes `npm i`, `firebase emulators:start` and `npx tsc --watch` which watches the files and restarts the server when the files are changed.
`npm run emu`は`npm i`, `firebase emulators:start`, `npx tsc --watch`を含んでいます。ファイルに変更があった場合にはAPIを自動で再起動します。

if you don't want ts-node to watch the files, just use
ファイル変更時に自動で再起動をしない場合は次のコマンドを実行してください。
```
firebase emulators:start
```

## Technical Documents
||Document in this project or related PR|Firebase/Google Cloud - Official Documents|
## 技術的なドキュメント
このプロジェクトはフロントエンドにTypeScript, Next.jsを使用し、バックエンドにTypeScript, Node.js, Firebaseを使用しています。
技術的な実装方法や仕様に関しては以下のドキュメントを参照してください。
||このプロジェクト内のドキュメント/関連するPR|Firebase/Google Cloudの公式ドキュメント|
|-|-|-|
|API|[API Document](./Documents/API.md)|[Firebase Cloud Functions](https://firebase.google.com/docs/functions)|
|Database|[Database Document](./Documents/Database.md)|[Firestore](https://firebase.google.com/docs/firestore)|
|Storage||[Cloud Storage for Firebase](https://firebase.google.com/docs/storage)|
|Authentication||[Firebase Authentication](https://firebase.google.com/docs/auth)|
|Receive Notification|[Cloud Messagingを実装 #49](https://github.com/MurakawaTakuya/todo-real/pull/49)|[Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/)|
|Schedule/Send Notificaiton|[期限が近い目標にCloud Tasksで通知を送信する機能を実装 #100](https://github.com/MurakawaTakuya/todo-real/pull/100)|[Cloud Tasks in Google Cloud](https://cloud.google.com/tasks/docs)|
|Security||[Firebase App Check](https://firebase.google.com/docs/app-check)|
|API|[API Document](./Documents/API.md)|[Cloud Functions for Firebase](https://firebase.google.com/docs/functions)|
|データベース|[Database Document](./Documents/Database.md)|[Cloud Firestore](https://firebase.google.com/docs/firestore)|
|ストレージ||[Cloud Storage for Firebase](https://firebase.google.com/docs/storage)|
|認証|[PR: ログイン機能をFirebase Authenticationに接続 #39](https://github.com/MurakawaTakuya/todo-real/pull/39)|[Firebase Authentication](https://firebase.google.com/docs/auth)|
|通知を受信|[PR: Cloud Messagingを実装 #49](https://github.com/MurakawaTakuya/todo-real/pull/49)|[Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/)|
|スケジューラー/通知を送信|[PR: 期限が近い目標にCloud Tasksで通知を送信する機能を実装 #100](https://github.com/MurakawaTakuya/todo-real/pull/100)|[Cloud Tasks in Google Cloud](https://cloud.google.com/tasks/docs)|
|セキュリティ|[PR: App CheckとAnalyticaの導入 #84](https://github.com/MurakawaTakuya/todo-real/pull/84)|[Firebase App Check](https://firebase.google.com/docs/app-check)|
|ログ||[Cloud Logging](https://firebase.google.com/docs/functions/writing-and-viewing-logs?hl=ja&gen=2nd)|
40 changes: 0 additions & 40 deletions functions/src/routers/userRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,46 +72,6 @@ router.get("/id/:userId", async (req: Request, res: Response) => {
}
});

// GET: userNameからユーザー情報を取得
router.get("/name/:userName", async (req: Request, res: Response) => {
const userName = req.params.userName;

if (!userName) {
return res.status(400).json({ message: "User name is required" });
}

try {
const userSnapshot = await getUserFromName(userName);

if (userSnapshot.empty) {
return res.status(404).json({ message: "User not found" });
}

const userData: User[] = await Promise.all(
userSnapshot.docs.map(async (doc) => {
const data = doc.data();
const userId = doc.id;
const totalCompletedGoals = await countCompletedGoals(userId);
const totalFailedGoals = await countFailedGoals(userId);
const streak = await getStreak(userId);

return {
userId,
name: data.name,
completed: totalCompletedGoals,
failed: totalFailedGoals,
streak,
};
})
);

return res.json(userData);
} catch (error) {
logger.error(error);
return res.status(500).json({ message: "Error fetching user data" });
}
});

// POST: 新しいユーザーを登録
router.post("/", async (req: Request, res: Response) => {
let userId: string;
Expand Down
Binary file modified public/img/app.webp
Binary file not shown.
Binary file modified public/img/blur.webp
Binary file not shown.
Binary file modified public/img/competition.webp
Binary file not shown.
Binary file modified public/img/completed1.webp
Binary file not shown.
Binary file modified public/img/completed2.webp
Binary file not shown.
Binary file modified public/img/copyGoal.webp
Binary file not shown.
Binary file modified public/img/create.webp
Binary file not shown.
Binary file modified public/img/failed.webp
Binary file not shown.
Binary file added public/img/goal.webp
Binary file not shown.
Binary file removed public/img/post.webp
Binary file not shown.
Binary file modified public/img/reaction.webp
Binary file not shown.
Binary file modified public/img/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/Components/GoalModal/GoalModalButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function GoalModalButton() {
display: "flex",
flexDirection: "row-reverse",
position: "fixed",
bottom: "90px",
bottom: "83px",
width: "100%",
maxWidth: "600px",
zIndex: 1000,
Expand Down
Loading
Loading