Skip to content

Commit

Permalink
Merge pull request #159 from laminne/fix/156-lint
Browse files Browse the repository at this point in the history
fix(lint): Lintエラーを解消した
  • Loading branch information
laminne authored Aug 8, 2023
2 parents 4b89d21 + 8665582 commit ddbf271
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/repository/inmemory/media.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { IMediaRepository } from "../media.js";
import { Media } from "../../domain/media.js";
import { Failure, Result, Success } from "../../helpers/result.js";
Expand Down Expand Up @@ -49,7 +50,7 @@ export class MediaRepository implements IMediaRepository {
}
}

async Update(m: Media): Promise<Result<Media, Error>> {
async Update(): Promise<Result<Media, Error>> {
return new Failure(new Error(""));
}
}
13 changes: 7 additions & 6 deletions src/repository/inmemory/post.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { IPostRepository } from "../post.js";
import { AsyncResult, Failure, Result, Success } from "../../helpers/result.js";
import { Post } from "../../domain/post.js";
Expand Down Expand Up @@ -41,18 +42,18 @@ export class PostRepository implements IPostRepository {
}
}

async Update(p: Post): Promise<Result<Post, Error>> {
async Update(): Promise<Result<Post, Error>> {
return new Failure(new Error(""));
}

async Delete(id: Snowflake): AsyncResult<void, Error> {
async Delete(): AsyncResult<void, Error> {
return new Failure(new Error("todo"));
}

async ChronologicalPosts(
userID: Snowflake,
cursor: number,
): AsyncResult<{ posts: Post; author: User }[], Error> {
async ChronologicalPosts(): AsyncResult<
{ posts: Post; author: User }[],
Error
> {
try {
// ToDo: 自分がフォローしているユーザーの投稿の取得
[...this.data].filter((v) => {
Expand Down
3 changes: 2 additions & 1 deletion src/repository/inmemory/server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { IServerRepository } from "../server.js";
import { Server } from "../../domain/server.js";
import { Failure, Result, Success } from "../../helpers/result.js";
Expand Down Expand Up @@ -37,7 +38,7 @@ export class ServerRepository implements IServerRepository {
}
}

async Update(s: Server): Promise<Result<Server, Error>> {
async Update(): Promise<Result<Server, Error>> {
return new Failure(new Error(""));
}
}
7 changes: 4 additions & 3 deletions src/repository/inmemory/user.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { IUserRepository } from "../user.js";
import { AsyncResult, Failure, Result, Success } from "../../helpers/result.js";
import { User } from "../../domain/user.js";
Expand Down Expand Up @@ -38,12 +39,12 @@ export class UserRepository implements IUserRepository {
}
}

async Update(u: User): Promise<Result<User, Error>> {
async Update(): Promise<Result<User, Error>> {
return new Failure(new Error(""));
}

// 指定したユーザーがフォローしているユーザー一覧を取得
async FindFollowing(id: Snowflake): AsyncResult<Array<User>, Error> {
async FindFollowing(): AsyncResult<Array<User>, Error> {
try {
// ToDo: 実装する
return new Success(new Array<User>());
Expand All @@ -55,7 +56,7 @@ export class UserRepository implements IUserRepository {
}

// 指定したユーザーをフォローしているユーザー一覧を取得
async FindFollower(id: Snowflake): AsyncResult<Array<User>, Error> {
async FindFollower(): AsyncResult<Array<User>, Error> {
try {
// ToDo: 実装する
return new Success(new Array<User>());
Expand Down
1 change: 1 addition & 0 deletions src/repository/prisma/post.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { IPostRepository } from "../post.js";
import { AsyncResult, Failure, Result, Success } from "../../helpers/result.js";
import { Post, PostReactionEvent } from "../../domain/post.js";
Expand Down
1 change: 1 addition & 0 deletions src/repository/prisma/user.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { IUserRepository } from "../user.js";
import { AsyncResult, Failure, Result, Success } from "../../helpers/result.js";
import { User, UserAPData, UserFollowEvent } from "../../domain/user.js";
Expand Down
4 changes: 1 addition & 3 deletions src/server/controller/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ export class PostController {
);
}

async FindByHandle(
handle: string,
): AsyncResult<Array<CommonPostResponse>, Error> {
async FindByHandle(): AsyncResult<Array<CommonPostResponse>, Error> {
// ToDo: Implement
return new Success(Array<CommonPostResponse>());
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/handlers/activitypub/nodeinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class NodeInfoHandlers {
this.controller = c;
}

public Handle: FastifyHandlerMethod<{}> = async (q, r) => {
public Handle: FastifyHandlerMethod<{ Params: object }> = async (q, r) => {
const res = this.controller.Handle();
return r.code(200).send(res);
};
Expand Down
5 changes: 4 additions & 1 deletion src/server/handlers/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export class PostHandler {
r.code(204).send();
};

public GetTimeline: FastifyHandlerMethod<{}> = async (q, r) => {
public GetTimeline: FastifyHandlerMethod<{ Params: object }> = async (
q,
r,
) => {
const res = await this.controller.ChronologicalPosts("123");
if (res.isFailure()) {
const [code, message] = ErrorConverter(res.value);
Expand Down
3 changes: 2 additions & 1 deletion src/server/start.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { fastify } from "fastify";
import { PostHandler } from "./handlers/post.js";
import { PostRepository } from "../repository/prisma/post.js";
Expand Down Expand Up @@ -79,7 +80,7 @@ export async function StartServer(port: number) {
const personHandler = new PersonHandler(
new PersonController(new FindUserService(userRepository)),
);
app.get("/", (q, s) => {
app.get("/", () => {
return { version: "Qip2 Server v0.0.1 (pre-alpha)" };
});

Expand Down
1 change: 1 addition & 0 deletions src/service/data/user.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Snowflake } from "../../helpers/id_generator.js";
import { User, UserAPData, UserFollowEvent } from "../../domain/user.js";

Expand Down

0 comments on commit ddbf271

Please sign in to comment.