Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce zod for server-side validations #4397

Merged
merged 24 commits into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a6fa490
chore(server): use zod for validations
apoorv-mishra Nov 7, 2022
83daab3
fix(server): use ctx.input for documents.list
apoorv-mishra Nov 10, 2022
905844c
fix(server): schema for documents.archived
apoorv-mishra Nov 10, 2022
302e898
fix(server): documents.deleted, documents.viewed & documents.drafts
apoorv-mishra Nov 10, 2022
3459223
fix(server): documents.info
apoorv-mishra Nov 10, 2022
096199f
fix(server): documents.export & documents.restore
apoorv-mishra Nov 10, 2022
e8a2214
fix(server): documents.search_titles & documents.search
apoorv-mishra Nov 10, 2022
7d535ed
fix(server): documents.templatize
apoorv-mishra Nov 10, 2022
c1bc9df
fix(server): replace nullish() with optional()
apoorv-mishra Nov 10, 2022
9b3f875
fix(server): documents.update
apoorv-mishra Nov 11, 2022
9ea32ef
fix(server): documents.move
apoorv-mishra Nov 11, 2022
24299c1
fix(server): remaining
apoorv-mishra Nov 11, 2022
8e0ed73
fix(server): add validation for snippet min and max words
apoorv-mishra Nov 11, 2022
2804f7f
fix(server): fix update types
apoorv-mishra Nov 11, 2022
a675997
fix(server): remove DocumentSchema
apoorv-mishra Nov 11, 2022
17bbdd2
fix(server): collate duplicate schemas
apoorv-mishra Nov 11, 2022
3627781
fix: typos
apoorv-mishra Nov 11, 2022
b82c22d
fix: reviews
apoorv-mishra Nov 12, 2022
59161eb
Merge branch 'main' into refactor/4284/server-side-validatations
apoorv-mishra Nov 22, 2022
0794450
chore: Fixed case of Metrics import
tommoor Nov 23, 2022
9c9ff87
fix: restructure /api
apoorv-mishra Nov 23, 2022
32ac3b8
fix: loosen validation for id as it can be a slug too
apoorv-mishra Nov 23, 2022
c90a00e
Merge branch 'refactor/4284/server-side-validatations' of github.com:…
tommoor Nov 24, 2022
88fc614
Add test for query by slug
tommoor Nov 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions server/routes/api/documents/documents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ describe("#documents.info", () => {
expect(body.data.id).toEqual(document.id);
});

it("should return published document for urlId", async () => {
const { user, document } = await seed();
const res = await server.post("/api/documents.info", {
body: {
token: user.getJwtToken(),
id: document.urlId,
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.id).toEqual(document.id);
});

Comment on lines +50 to +62
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this! Thanks for adding 🙏

it("should return archived document", async () => {
const { user, document } = await seed();
await document.archive(user.id);
Expand Down
4 changes: 1 addition & 3 deletions server/routes/api/documents/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import documents from "./documents";

export default documents;
export { default } from "./documents";