-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feat: 通知に関する API スキーマの定義
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import "@typespec/http"; | ||
import "@typespec/rest"; | ||
import "../models/errors.tsp"; | ||
import "../models/notification.tsp"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
|
||
@service | ||
namespace SeichiPortalApiSchema; | ||
|
||
@tag("Notifications") | ||
@route("/notifications") | ||
namespace Notifications { | ||
@get | ||
@summary("通知一覧を返す") | ||
op notifications(): { | ||
@statusCode statusCode: 200; | ||
@body body: Notification[]; | ||
} | { | ||
@statusCode statusCode: 401 | 403 | 500; | ||
@body body: Error; | ||
}; | ||
|
||
@post | ||
@summary("すべて既読にする") | ||
op readAll(): { | ||
@statusCode statusCode: 204; | ||
} | { | ||
@statusCode statusCode: 401 | 403 | 500; | ||
@body body: Error; | ||
}; | ||
|
||
@post | ||
@summary("通知を既読にする") | ||
@route("/{id}") | ||
op read(@path id: NotificationId): { | ||
@statusCode statusCode: 204; | ||
} | { | ||
@statusCode statusCode: 401 | 403 | 404 | 500; | ||
@body body: Error; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
enum NotificationSource { | ||
FormMessage, | ||
} | ||
|
||
model NotificationSourceInfo { | ||
source: NotificationSource; | ||
url: string; | ||
} | ||
|
||
@format("uuid") | ||
scalar NotificationId extends string; | ||
|
||
model Notification { | ||
@visibility("read") | ||
id: NotificationId; | ||
|
||
source: NotificationSourceInfo; | ||
title: string; | ||
is_read: boolean; | ||
} |