prettier fixes

This commit is contained in:
2020-06-09 12:57:05 +03:00
parent 51a6803fe2
commit 70a3907327
9 changed files with 30 additions and 36 deletions

View File

@@ -1,12 +1,12 @@
import * as React from "react";
import { shallow } from "enzyme";
import { AccountComponent } from "../Account";
describe("<Account />", () => {
it("should say hello", () => {
const wrapper = shallow(<AccountComponent />);
expect(wrapper.text()).toBe("Hello");
});
});
import * as React from "react";
import { shallow } from "enzyme";
import { AccountComponent } from "../Account";
describe("<Account />", () => {
it("should say hello", () => {
const wrapper = shallow(<AccountComponent />);
expect(wrapper.text()).toBe("Hello");
});
});

View File

@@ -10,7 +10,7 @@ export interface IDocumentListProps {
}
export function DocumentsList(props: IDocumentListProps) {
const cards = props.docs.map(doc => (
const cards = props.docs.map((doc) => (
<DocumentCard key={doc.id} doc={doc} />
));

View File

@@ -28,7 +28,7 @@
// keeps the breadcrumbs from taking all the space
max-width: 70%;
}
* {
transition: 0.3s;
}
@@ -50,4 +50,4 @@
.bp3-navbar {
transition: 0.3s;
}
}
}

View File

@@ -53,7 +53,7 @@ export const docsReducer: Reducer<IDocsState, DocsAction> = (
return { ...defaultDocsState, fetching: true };
case DocsTypes.DOCS_FETCH_SUCCESS: {
const all: { [key: number]: IDocumentEntry } = {};
action.payload.all.forEach(doc => {
action.payload.all.forEach((doc) => {
all[doc.id] = { ...doc, remote: doc, dirty: false };
});
return { ...defaultDocsState, all };
@@ -90,7 +90,7 @@ export const docsReducer: Reducer<IDocsState, DocsAction> = (
}
case DocsTypes.DOCS_UPLOAD_SUCCESS: {
const all: { [key: number]: IDocumentEntry } = { ...state.all };
action.payload.all.forEach(doc => {
action.payload.all.forEach((doc) => {
if (isDocDirty(all[doc.id], doc)) {
all[doc.id] = { ...all[doc.id], remote: doc, dirty: true };
} else {
@@ -130,7 +130,7 @@ export const docsReducer: Reducer<IDocsState, DocsAction> = (
shared: payload.shared,
dirty: false,
};
const dirtyDocs = Object.values(all).filter(e => e.dirty);
const dirtyDocs = Object.values(all).filter((e) => e.dirty);
dirty = dirtyDocs.length > 0;
}
return { ...state, all, dirty };

View File

@@ -139,7 +139,7 @@ function* docsUploadStart(action: IDocsUploadStartAction) {
const allDocs = state.docs.all;
const changedDocs: IDocumentJSON[] = Object.values(allDocs).filter(
e => e.dirty,
(e) => e.dirty,
);
const updatedDocs: IDocumentJSON[] = [];

View File

@@ -23,10 +23,7 @@ export class Document extends BaseEntity {
@PrimaryGeneratedColumn()
public id: number;
@ManyToOne(
type => User,
user => user.documents,
)
@ManyToOne((type) => User, (user) => user.documents)
public user: User;
@Column({ length: 190 })

View File

@@ -40,10 +40,7 @@ export class User extends BaseEntity {
@Column({ length: 190 })
public passwordHash: string;
@OneToMany(
type => Document,
document => document.user,
)
@OneToMany((type) => Document, (document) => document.user)
public documents: Document[];
constructor(username: string, email: string) {

View File

@@ -4,7 +4,7 @@ import { User } from "~entity/User";
export const docsRouter = new Router();
docsRouter.post("/docs/new", async ctx => {
docsRouter.post("/docs/new", async (ctx) => {
if (!ctx.state.user) {
ctx.throw(401);
}
@@ -35,7 +35,7 @@ docsRouter.post("/docs/new", async ctx => {
};
});
docsRouter.patch("/docs/byID/:id", async ctx => {
docsRouter.patch("/docs/byID/:id", async (ctx) => {
if (!ctx.state.user) {
ctx.throw(401);
}
@@ -85,7 +85,7 @@ docsRouter.patch("/docs/byID/:id", async ctx => {
};
});
docsRouter.get("/docs/list", async ctx => {
docsRouter.get("/docs/list", async (ctx) => {
if (!ctx.state.user) {
ctx.throw(401);
}
@@ -96,11 +96,11 @@ docsRouter.get("/docs/list", async ctx => {
ctx.body = {
error: false,
data: documents.map(document => document.toJSON(user.id)),
data: documents.map((document) => document.toJSON(user.id)),
};
});
docsRouter.get("/docs/byID/:id", async ctx => {
docsRouter.get("/docs/byID/:id", async (ctx) => {
if (!ctx.state.user) {
ctx.throw(401);
}
@@ -127,7 +127,7 @@ docsRouter.get("/docs/byID/:id", async ctx => {
};
});
docsRouter.get("/docs/shared/:username/:id", async ctx => {
docsRouter.get("/docs/shared/:username/:id", async (ctx) => {
const { id, username } = ctx.params as {
id: number | undefined;
username: string | undefined;
@@ -159,7 +159,7 @@ docsRouter.get("/docs/shared/:username/:id", async ctx => {
};
});
docsRouter.delete("/docs/byID/:id", async ctx => {
docsRouter.delete("/docs/byID/:id", async (ctx) => {
if (!ctx.state.user) {
ctx.throw(401);
}

View File

@@ -3,9 +3,9 @@ import { config } from "~config";
import { connect } from "~config/database";
connect()
.then(async connection => {
.then(async (connection) => {
console.log(`connected to ${connection.name}`);
app.listen(config.port);
console.log(`listening at ${config.port}`);
})
.catch(error => console.log(error));
.catch((error) => console.log(error));