Commit Graph

51 Commits

Author SHA1 Message Date
ae10a295d4
refactor(server/middleware): log model names twice (before and after connection) 2023-12-30 15:59:27 -05:00
8f45dbe563
style(*): edit indents 2023-12-29 20:53:29 -05:00
c8e84c909e
style(*): cleanup unused imports 2023-12-29 20:11:07 -05:00
1447960b1a
refactor(db/models): update populatedDoc types
- remove `& Document` qualifier
- cast `T | number` to T with the `as` keyword
2023-12-29 19:06:55 -05:00
f611c56c39
fix(server/utils): update recaptcha guard
- use actual form field (it's not "g-recaptcha-response")
- switch from useFetch to axios
- use "application/x-www-form-urlencoded" as content type
2023-12-29 18:04:33 -05:00
e62924f6ec
refactor(server/utils): update storyQuerier.ts
make paths and imports more concise and correct
2023-12-29 16:39:41 -05:00
1a99cf6fb5
refactor(api/utils): populate coAuthor in helpers 2023-12-29 16:38:30 -05:00
922807ba6a
refactor(server/utils): make paths and imports more concise and correct 2023-12-29 16:34:00 -05:00
9f0a76e2b0
refactor(server/utils): remove env logging 2023-12-29 12:45:15 -05:00
696ce44290
refactor(server/plugins): add user and password to mongoose connect options 2023-12-28 19:58:54 -05:00
60e564781d
refactor(*): use more sane path aliases 2023-12-28 19:58:26 -05:00
3e5af47107
refactor(*): refactor tsconfig paths
looks/feels nicer
2023-12-20 17:23:31 -05:00
9ba432a8e0
fix(server/utils): add isIdNan helper function 2023-12-20 17:03:58 -05:00
088232f750
refactor(api & server/utils): refactor imports of db helpers
create an index file which exports the functions we need in one accessible place
2023-12-11 21:29:46 -05:00
0ebc25a1c8
refactor(server/utils): allow an IDraft to be passed to permission checker 2023-12-11 21:20:06 -05:00
fd4de6489f
refactor(server/utils): move html normalizer into its own importable function 2023-12-11 21:13:22 -05:00
f57fd2df84
chore(api/utils): remove unused import 2023-12-09 17:48:07 -05:00
7e300734d8
refactor(api/utils): switch to if...else if for each check 2023-12-09 17:32:24 -05:00
e8aea81b0b
fix(server/utils): add null check to storyQuerier 2023-12-09 17:01:13 -05:00
46c9a07b7d
refactor(api/utils): add isLoggedIn guard to story checks 2023-12-09 17:00:22 -05:00
22816477eb
refactor(server/utils): add chapter index parameter to storyCheck function 2023-12-06 22:11:41 -05:00
c27c81f39c
refactor(api/utils): update isAdmin check
make it also check that the user is logged in; eliminates need to type `isLoggedIn()` on the previous line
2023-12-06 21:37:54 -05:00
45783c60a9
refactor(api/utils): update listQuerier helper
make it return an object containing a sliced array and a total
2023-12-06 21:31:50 -05:00
3a1ddf55e4
refactor(server/middleware): remove mongoose debug flag, set overwriteModels to true 2023-12-06 21:25:47 -05:00
d5de2499ab
refactor(server/utils): make the chapter index parameter in the chapterTransformer function mandatory 2023-12-01 17:57:17 -05:00
20b69c82da
fix(server/utils): prepend . to file extension checks 2023-10-12 22:58:10 -04:00
b1c94ab0ae
refactor: edit common function for database plugin and middleware 2023-10-11 16:51:03 -04:00
64f3bf23ea
refactor(server/utils): add chapter index argument to chapterTransformer 2023-10-11 16:37:18 -04:00
01d3b7f22b
feat(api): integrate co-author feature in api routes and helpers 2023-10-11 15:31:02 -04:00
c502acbba9
fix(api/utils): fix listquerier
make it so that `author` is an object we can assign to, NOT a number
2023-10-10 22:25:25 -04:00
e50fd2aba9
refactor: change log verbosity to silly (for now) 2023-10-10 22:20:04 -04:00
90b0256008
refactor(server/utils): create gridfs bucket for draft contents 2023-10-10 22:05:26 -04:00
dd74c8417a
fix(server/utils): fix mammoth and sanitize-html imports
(make it so that we're not importing a namespace instead of a default export)
2023-10-10 22:04:42 -04:00
ac6dc8ed09
refactor(api/utils): improve logger 2023-10-05 02:05:52 -04:00
490fa1469e
refactor(server/utils): create utility to return forum database's uid using the actual site's user id 2023-10-03 01:10:00 -04:00
6ae407c600
refactor(server/utils): add reusable ficmas utility functions 2023-10-03 01:07:29 -04:00
80438ecacd
refactor(server/utils): create custom winston logger 2023-10-03 01:03:31 -04:00
21360669d8
refactor(server/utils): add constants file 2023-10-03 00:53:10 -04:00
dd9fcaf5ae
refactor(api/utils): add story query helper function
to avoid having to write the same `populate` calls over and over
2023-10-03 00:52:24 -04:00
bef6e79317
refactor(server/utils): export all story helpers from a single index.ts file
this is to remove the need for importing from several different files
2023-10-03 00:51:12 -04:00
1059b560e6
refactor(api/utils): replace repetitive "forbidden" and "unauthorized" literals with constant references 2023-10-03 00:50:00 -04:00
66d6168a31
refactor(server/utils): add transformer for regular chapter objects
this transforms a story object into a slightly different object to be served by the api. notable differences are the `totalChapters` field and the removal of the `chapters` array. `chapters` is then replaced by a `currentChapter` object, representing the currently "selected" chapter, with an added `text` field
2023-10-03 00:46:57 -04:00
c8bdcc0ec3
refactor(server/utils): create reusable utilities for various story-related functions
`bodyHandler` takes a request body and returns the chapter content as a string
`formChapterTransform` serializes a chapter-like object supplied in a request body to an actual
	proper chapter object
`getBucket` retrieves the story content gridfs bucket
`replaceGridFS` either creates or updates (deletes + reuploads) a gridfs file
2023-10-03 00:42:24 -04:00
1338e87238
feat(api/utils): add isadmin check 2023-10-03 00:33:54 -04:00
c9574dfc29
refactor(server/utils): move listQuerier to separate database helper folder 2023-10-03 00:30:22 -04:00
09187fa5ac
feat(api): add captcha verify utility 2023-10-03 00:26:51 -04:00
2b0d478ca7
feat(api): add isLoggedIn utility function
for api routes which require authentication
2023-10-02 16:20:13 -04:00
cfb1f69ffb
refactor(server/middleware): move common logic for maintaining a database connection to another file 2023-10-02 16:08:12 -04:00
ff4b94d913
feat(api): ✏️ add story api endpoints
(update/create/delete)
2023-10-02 15:44:55 -04:00
fea42915fb
refactor(api): update story query helper
it now filters out stories with nonexistent authors
2023-09-26 14:23:11 -04:00