mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
Add new user statuses endoint (and tests)
This commit is contained in:
parent
c0c6067d4d
commit
36b682d662
3 changed files with 33 additions and 2 deletions
|
|
@ -33,13 +33,15 @@ export default async (
|
|||
|
||||
if (!user) return errorResponse("User not found", 404);
|
||||
|
||||
// TODO: Check if status can be seen by this user
|
||||
const statuses = await Status.find({
|
||||
where: {
|
||||
account: {
|
||||
id: user.id,
|
||||
},
|
||||
isReblog: !exclude_reblogs,
|
||||
isReblog: exclude_reblogs ? true : undefined,
|
||||
},
|
||||
relations: ["account", "emojis", "announces", "likes"],
|
||||
order: {
|
||||
created_at: "DESC",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { errorResponse, jsonResponse } from "@response";
|
|||
* Patches a user
|
||||
*/
|
||||
export default async (req: Request): Promise<Response> => {
|
||||
// TODO: Add checks for disabled or not email verified accounts
|
||||
// Check if request is a PATCH request
|
||||
if (req.method !== "GET")
|
||||
return errorResponse("This method requires a GET request", 405);
|
||||
|
|
@ -19,7 +20,6 @@ export default async (req: Request): Promise<Response> => {
|
|||
|
||||
if (!user) return errorResponse("Unauthorized", 401);
|
||||
|
||||
// TODO: Add Source fields
|
||||
return jsonResponse({
|
||||
...(await user.toAPI()),
|
||||
source: user.source,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue