Skip to content

Commit cdfc889

Browse files
committed
Professional member profiles with links and CV
- Headline, availability (open to work, freelance, hiring), up to 12 skills, portfolio and up to 4 extra links next to GitHub, LinkedIn, X - PDF CV (5 MB, magic bytes checked) stored outside public/, with a visibility choice (public, members, private); downloads are streamed with a sandbox CSP, nosniff, no-store and rate limits. Multipart is parsed only inside the CV controller, after auth and CSRF - Members directory filters by skill, availability and city - Uploads volume in docker-compose, backed up nightly; Caddy allows 6 MB on the CV upload only
1 parent 45a851c commit cdfc889

41 files changed

Lines changed: 3233 additions & 219 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.adonisjs/client/registry/index.ts‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,42 @@ const routes = {
408408
tokens: [{"old":"/settings/account","type":0,"val":"settings","end":""},{"old":"/settings/account","type":0,"val":"account","end":""}],
409409
types: placeholder as Registry['settings.account.destroy']['types'],
410410
},
411+
'settings.cv': {
412+
methods: ["GET","HEAD"],
413+
pattern: '/settings/cv',
414+
tokens: [{"old":"/settings/cv","type":0,"val":"settings","end":""},{"old":"/settings/cv","type":0,"val":"cv","end":""}],
415+
types: placeholder as Registry['settings.cv']['types'],
416+
},
417+
'settings.cv.store': {
418+
methods: ["POST"],
419+
pattern: '/settings/cv',
420+
tokens: [{"old":"/settings/cv","type":0,"val":"settings","end":""},{"old":"/settings/cv","type":0,"val":"cv","end":""}],
421+
types: placeholder as Registry['settings.cv.store']['types'],
422+
},
423+
'settings.cv.destroy': {
424+
methods: ["DELETE"],
425+
pattern: '/settings/cv',
426+
tokens: [{"old":"/settings/cv","type":0,"val":"settings","end":""},{"old":"/settings/cv","type":0,"val":"cv","end":""}],
427+
types: placeholder as Registry['settings.cv.destroy']['types'],
428+
},
429+
'settings.cv.visibility': {
430+
methods: ["PUT"],
431+
pattern: '/settings/cv/visibility',
432+
tokens: [{"old":"/settings/cv/visibility","type":0,"val":"settings","end":""},{"old":"/settings/cv/visibility","type":0,"val":"cv","end":""},{"old":"/settings/cv/visibility","type":0,"val":"visibility","end":""}],
433+
types: placeholder as Registry['settings.cv.visibility']['types'],
434+
},
411435
'profile.show': {
412436
methods: ["GET","HEAD"],
413437
pattern: '/:username',
414438
tokens: [{"old":"/:username","type":1,"val":"username","end":""}],
415439
types: placeholder as Registry['profile.show']['types'],
416440
},
441+
'profile.cv': {
442+
methods: ["GET","HEAD"],
443+
pattern: '/:username/cv',
444+
tokens: [{"old":"/:username/cv","type":1,"val":"username","end":""},{"old":"/:username/cv","type":0,"val":"cv","end":""}],
445+
types: placeholder as Registry['profile.cv']['types'],
446+
},
417447
'admin.index': {
418448
methods: ["GET","HEAD"],
419449
pattern: '/admin',

‎.adonisjs/client/registry/schema.d.ts‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,54 @@ export interface Registry {
811811
errorResponse: ExtractErrorResponse<Awaited<ReturnType<import('#controllers/settings_controller').default['destroyAccount']>>> | { status: 422; response: { errors: SimpleError[] } }
812812
}
813813
}
814+
'settings.cv': {
815+
methods: ["GET","HEAD"]
816+
pattern: '/settings/cv'
817+
types: {
818+
body: {}
819+
paramsTuple: []
820+
params: {}
821+
query: {}
822+
response: ExtractResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['show']>>>
823+
errorResponse: ExtractErrorResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['show']>>>
824+
}
825+
}
826+
'settings.cv.store': {
827+
methods: ["POST"]
828+
pattern: '/settings/cv'
829+
types: {
830+
body: ExtractBody<InferInput<(typeof import('#validators/settings_validator').cvUploadValidator)>>
831+
paramsTuple: []
832+
params: {}
833+
query: ExtractQuery<InferInput<(typeof import('#validators/settings_validator').cvUploadValidator)>>
834+
response: ExtractResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['store']>>>
835+
errorResponse: ExtractErrorResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['store']>>> | { status: 422; response: { errors: SimpleError[] } }
836+
}
837+
}
838+
'settings.cv.destroy': {
839+
methods: ["DELETE"]
840+
pattern: '/settings/cv'
841+
types: {
842+
body: {}
843+
paramsTuple: []
844+
params: {}
845+
query: {}
846+
response: ExtractResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['destroy']>>>
847+
errorResponse: ExtractErrorResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['destroy']>>>
848+
}
849+
}
850+
'settings.cv.visibility': {
851+
methods: ["PUT"]
852+
pattern: '/settings/cv/visibility'
853+
types: {
854+
body: ExtractBody<InferInput<(typeof import('#validators/settings_validator').cvVisibilityValidator)>>
855+
paramsTuple: []
856+
params: {}
857+
query: ExtractQuery<InferInput<(typeof import('#validators/settings_validator').cvVisibilityValidator)>>
858+
response: ExtractResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['updateVisibility']>>>
859+
errorResponse: ExtractErrorResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['updateVisibility']>>> | { status: 422; response: { errors: SimpleError[] } }
860+
}
861+
}
814862
'profile.show': {
815863
methods: ["GET","HEAD"]
816864
pattern: '/:username'
@@ -823,6 +871,18 @@ export interface Registry {
823871
errorResponse: ExtractErrorResponse<Awaited<ReturnType<import('#controllers/profile_controller').default['show']>>>
824872
}
825873
}
874+
'profile.cv': {
875+
methods: ["GET","HEAD"]
876+
pattern: '/:username/cv'
877+
types: {
878+
body: {}
879+
paramsTuple: [ParamValue]
880+
params: { username: ParamValue }
881+
query: {}
882+
response: ExtractResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['download']>>>
883+
errorResponse: ExtractErrorResponse<Awaited<ReturnType<import('#controllers/cv_controller').default['download']>>>
884+
}
885+
}
826886
'admin.index': {
827887
methods: ["GET","HEAD"]
828888
pattern: '/admin'

‎.adonisjs/client/registry/tree.d.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,15 @@ export interface ApiDefinition {
108108
account: typeof routes['settings.account'] & {
109109
destroy: typeof routes['settings.account.destroy']
110110
}
111+
cv: typeof routes['settings.cv'] & {
112+
store: typeof routes['settings.cv.store']
113+
destroy: typeof routes['settings.cv.destroy']
114+
visibility: typeof routes['settings.cv.visibility']
115+
}
111116
}
112117
profile: {
113118
show: typeof routes['profile.show']
119+
cv: typeof routes['profile.cv']
114120
}
115121
admin: {
116122
index: typeof routes['admin.index']

‎.adonisjs/server/controllers.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const controllers = {
2020
Register: () => import('#controllers/auth/register_controller'),
2121
Social: () => import('#controllers/auth/social_controller'),
2222
},
23+
Cv: () => import('#controllers/cv_controller'),
2324
Dashboard: () => import('#controllers/dashboard_controller'),
2425
DiscussionActions: () => import('#controllers/discussion_actions_controller'),
2526
Discussions: () => import('#controllers/discussions_controller'),

‎.adonisjs/server/pages.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ declare module '@adonisjs/inertia/types' {
4242
'profile/show': ExtractProps<(typeof import('../../inertia/pages/profile/show.tsx'))['default']>
4343
'search/index': ExtractProps<(typeof import('../../inertia/pages/search/index.tsx'))['default']>
4444
'settings/account': ExtractProps<(typeof import('../../inertia/pages/settings/account.tsx'))['default']>
45+
'settings/cv': ExtractProps<(typeof import('../../inertia/pages/settings/cv.tsx'))['default']>
4546
'settings/password': ExtractProps<(typeof import('../../inertia/pages/settings/password.tsx'))['default']>
4647
'settings/profile': ExtractProps<(typeof import('../../inertia/pages/settings/profile.tsx'))['default']>
4748
}

‎.adonisjs/server/routes.d.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ export type ScannedRoutes = {
7171
'settings.password.update': { paramsTuple?: []; params?: {} }
7272
'settings.account': { paramsTuple?: []; params?: {} }
7373
'settings.account.destroy': { paramsTuple?: []; params?: {} }
74+
'settings.cv': { paramsTuple?: []; params?: {} }
75+
'settings.cv.store': { paramsTuple?: []; params?: {} }
76+
'settings.cv.destroy': { paramsTuple?: []; params?: {} }
77+
'settings.cv.visibility': { paramsTuple?: []; params?: {} }
7478
'profile.show': { paramsTuple: [ParamValue]; params: {'username': ParamValue} }
79+
'profile.cv': { paramsTuple: [ParamValue]; params: {'username': ParamValue} }
7580
'admin.index': { paramsTuple?: []; params?: {} }
7681
'admin.reports.index': { paramsTuple?: []; params?: {} }
7782
'admin.reports.resolve': { paramsTuple: [ParamValue,ParamValue]; params: {'target': ParamValue,'id': ParamValue} }
@@ -122,7 +127,9 @@ export type ScannedRoutes = {
122127
'settings.profile': { paramsTuple?: []; params?: {} }
123128
'settings.password': { paramsTuple?: []; params?: {} }
124129
'settings.account': { paramsTuple?: []; params?: {} }
130+
'settings.cv': { paramsTuple?: []; params?: {} }
125131
'profile.show': { paramsTuple: [ParamValue]; params: {'username': ParamValue} }
132+
'profile.cv': { paramsTuple: [ParamValue]; params: {'username': ParamValue} }
126133
'admin.index': { paramsTuple?: []; params?: {} }
127134
'admin.reports.index': { paramsTuple?: []; params?: {} }
128135
'admin.members.index': { paramsTuple?: []; params?: {} }
@@ -161,7 +168,9 @@ export type ScannedRoutes = {
161168
'settings.profile': { paramsTuple?: []; params?: {} }
162169
'settings.password': { paramsTuple?: []; params?: {} }
163170
'settings.account': { paramsTuple?: []; params?: {} }
171+
'settings.cv': { paramsTuple?: []; params?: {} }
164172
'profile.show': { paramsTuple: [ParamValue]; params: {'username': ParamValue} }
173+
'profile.cv': { paramsTuple: [ParamValue]; params: {'username': ParamValue} }
165174
'admin.index': { paramsTuple?: []; params?: {} }
166175
'admin.reports.index': { paramsTuple?: []; params?: {} }
167176
'admin.members.index': { paramsTuple?: []; params?: {} }
@@ -193,6 +202,7 @@ export type ScannedRoutes = {
193202
'notifications.read_all': { paramsTuple?: []; params?: {} }
194203
'notifications.read': { paramsTuple: [ParamValue]; params: {'id': ParamValue} }
195204
'reports.store': { paramsTuple?: []; params?: {} }
205+
'settings.cv.store': { paramsTuple?: []; params?: {} }
196206
'admin.reports.resolve': { paramsTuple: [ParamValue,ParamValue]; params: {'target': ParamValue,'id': ParamValue} }
197207
'admin.reports.dismiss': { paramsTuple: [ParamValue,ParamValue]; params: {'target': ParamValue,'id': ParamValue} }
198208
'admin.members.ban': { paramsTuple: [ParamValue]; params: {'id': ParamValue} }
@@ -206,6 +216,7 @@ export type ScannedRoutes = {
206216
'discussions.update': { paramsTuple: [ParamValue]; params: {'slug': ParamValue} }
207217
'settings.profile.update': { paramsTuple?: []; params?: {} }
208218
'settings.password.update': { paramsTuple?: []; params?: {} }
219+
'settings.cv.visibility': { paramsTuple?: []; params?: {} }
209220
'admin.members.role': { paramsTuple: [ParamValue]; params: {'id': ParamValue} }
210221
'admin.tags.update': { paramsTuple: [ParamValue]; params: {'id': ParamValue} }
211222
'admin.channels.update': { paramsTuple: [ParamValue]; params: {'id': ParamValue} }
@@ -217,6 +228,7 @@ export type ScannedRoutes = {
217228
'forum.solution.destroy': { paramsTuple: [ParamValue]; params: {'slug': ParamValue} }
218229
'discussions.destroy': { paramsTuple: [ParamValue]; params: {'slug': ParamValue} }
219230
'settings.account.destroy': { paramsTuple?: []; params?: {} }
231+
'settings.cv.destroy': { paramsTuple?: []; params?: {} }
220232
'admin.reports.destroy': { paramsTuple: [ParamValue,ParamValue]; params: {'target': ParamValue,'id': ParamValue} }
221233
'admin.members.unban': { paramsTuple: [ParamValue]; params: {'id': ParamValue} }
222234
'admin.tags.destroy': { paramsTuple: [ParamValue]; params: {'id': ParamValue} }

‎.dockerignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules
22
build
33
tmp
4+
storage
45
.git
56
.github
67
.env

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ build
44
tmp/*
55
!tmp/.gitkeep
66

7+
# Uploaded files (members' CVs): never committed
8+
storage/
9+
710
# Secrets
811
.env
912
.env.local

‎Dockerfile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ ENV NODE_ENV=production \
3434
COPY --from=production-deps --chown=node:node /app/node_modules ./node_modules
3535
COPY --from=build --chown=node:node /app/build ./
3636
COPY --chown=node:node docker/entrypoint.sh /usr/local/bin/entrypoint.sh
37-
RUN chmod +x /usr/local/bin/entrypoint.sh && mkdir -p tmp && chown node:node tmp
37+
# storage/ holds the uploaded CVs: the "uploads" volume is mounted there
38+
# (docker-compose.yml). Docker seeds an empty named volume with this
39+
# directory's ownership, so the app (user "node") can write to it.
40+
RUN chmod +x /usr/local/bin/entrypoint.sh \
41+
&& mkdir -p tmp storage/cvs \
42+
&& chown node:node tmp storage storage/cvs \
43+
&& chmod 750 storage storage/cvs
3844
USER node
3945
EXPOSE 3333
4046
HEALTHCHECK --interval=30s --timeout=5s --start-period=40s --retries=3 \

0 commit comments

Comments
 (0)