Skip to content

Commit

Permalink
Merge pull request #173 from GiganticMinecraft/feat/message-api
Browse files Browse the repository at this point in the history
メッセージ用エンドポイント定義の移動
  • Loading branch information
rito528 authored Nov 6, 2024
2 parents 27fc926 + 6d68221 commit e02f8a2
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 64 deletions.
75 changes: 75 additions & 0 deletions src/endpoints/forms.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "@typespec/http";
import "@typespec/rest";
import "../models/errors.tsp";
import "../models/form.tsp";
import "../models/message.tsp";

@service
namespace SeichiPortalApiSchema;
Expand Down Expand Up @@ -295,6 +296,80 @@ namespace Forms {
@statusCode statusCode: 400 | 401 | 403 | 500;
@body body: Error;
};

@tag("Messages")
@route("/messages")
namespace Messages {
@post
@summary("メッセージの新規作成")
op create_message(
@header
contentType: "application/json",

@path answerId: uint32,
@body body: {
body: string;
},
): {
@statusCode statusCode: 201;
@body body: {
id: uint32;
};
@header header: {
Location: string;
};
} | {
@statusCode statusCode: 400 | 401 | 403 | 500;
@body body: Error;
};

@get
@summary("メッセージの一覧取得")
op messages(@path answerId: uint32): {
@statusCode statusCode: 200;
@body body: {
messages: Message[];
};
} | {
@statusCode statusCode: 400 | 401 | 403 | 500;
@body body: Error;
};

@route("/{message_id}")
namespace InvidualMessage {
@patch
@summary("メッセージの更新")
op update_message(
@path answerId: uint32,

@path
message_id: uint32,

@body body: {
body: string;
},
): {
@statusCode statusCode: 204;
} | {
@statusCode statusCode: 400 | 401 | 403 | 500;
@body body: Error;
};

@delete
@summary("メッセージの削除")
op delete_message(
@path answerId: uint32,

@path
message_id: uint32,
): {
@statusCode statusCode: 204;
} | {
@statusCode statusCode: 400 | 401 | 403 | 500;
@body body: Error;
};
}
}
}

@route("/comment")
Expand Down
63 changes: 0 additions & 63 deletions src/endpoints/messages.tsp

This file was deleted.

1 change: 0 additions & 1 deletion src/main.tsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import "./endpoints/forms.tsp";
import "./endpoints/messages.tsp";
import "./endpoints/users.tsp";
import "./endpoints/session.tsp";
import "@typespec/openapi";
Expand Down

0 comments on commit e02f8a2

Please sign in to comment.