@@ -31,7 +31,8 @@ import { getServiceConfig } from './config.js'
3131import {
3232 withMode ,
3333 READ_ONLY as RO ,
34- READ_WRITE as RW ,
34+ READ_WRITE_ONLY as RW ,
35+ READ_WRITE_CREATE as RWC ,
3536} from './middleware/maintenance.js'
3637import { getContext } from './utils/context.js'
3738import { withAuth } from './middleware/auth.js'
9697r . add (
9798 'post' ,
9899 '/pins' ,
99- withAuth ( withMode ( pinsAdd , RW ) , {
100+ withAuth ( withMode ( pinsAdd , RWC ) , {
100101 checkHasPsaAccess,
101102 checkHasAccountRestriction,
102103 } ) ,
@@ -105,7 +106,7 @@ r.add(
105106r . add (
106107 'post' ,
107108 '/pins/:requestid' ,
108- withAuth ( withMode ( pinsReplace , RW ) , {
109+ withAuth ( withMode ( pinsReplace , RWC ) , {
109110 checkHasPsaAccess,
110111 checkHasAccountRestriction,
111112 } ) ,
@@ -114,7 +115,7 @@ r.add(
114115r . add (
115116 'delete' ,
116117 '/pins/:requestid' ,
117- withAuth ( withMode ( pinsDelete , RW ) , {
118+ withAuth ( withMode ( pinsDelete , RWC ) , {
118119 checkHasDeleteRestriction,
119120 checkHasPsaAccess,
120121 } ) ,
@@ -128,7 +129,7 @@ r.add('get', '/:cid', withAuth(withMode(nftGet, RO)), [postCors])
128129r . add (
129130 'post' ,
130131 '/upload' ,
131- withAuth ( withMode ( nftUpload , RW ) , {
132+ withAuth ( withMode ( nftUpload , RWC ) , {
132133 checkHasAccountRestriction,
133134 checkUcan,
134135 } ) ,
@@ -137,24 +138,24 @@ r.add(
137138r . add (
138139 'patch' ,
139140 '/upload/:cid' ,
140- withAuth ( withMode ( nftUpdateUpload , RW ) , { checkHasAccountRestriction } ) ,
141+ withAuth ( withMode ( nftUpdateUpload , RWC ) , { checkHasAccountRestriction } ) ,
141142 [ postCors ]
142143)
143144r . add (
144145 'post' ,
145146 '/store' ,
146- withAuth ( withMode ( nftStore , RW ) , { checkHasAccountRestriction } ) ,
147+ withAuth ( withMode ( nftStore , RWC ) , { checkHasAccountRestriction } ) ,
147148 [ postCors ]
148149)
149150r . add (
150151 'delete' ,
151152 '/:cid' ,
152- withAuth ( withMode ( nftDelete , RW ) , { checkHasDeleteRestriction } ) ,
153+ withAuth ( withMode ( nftDelete , RWC ) , { checkHasDeleteRestriction } ) ,
153154 [ postCors ]
154155)
155156
156157// Temporary Metaplex upload route, mapped to metaplex user account.
157- r . add ( 'post' , '/metaplex/upload' , withMode ( metaplexUpload , RW ) , [ postCors ] )
158+ r . add ( 'post' , '/metaplex/upload' , withMode ( metaplexUpload , RWC ) , [ postCors ] )
158159
159160// User
160161r . add (
@@ -206,7 +207,7 @@ r.add(
206207r . add (
207208 'post' ,
208209 '/api/pins' ,
209- withAuth ( withMode ( pinsAdd , RW ) , {
210+ withAuth ( withMode ( pinsAdd , RWC ) , {
210211 checkHasPsaAccess,
211212 checkHasAccountRestriction,
212213 } ) ,
@@ -215,7 +216,7 @@ r.add(
215216r . add (
216217 'post' ,
217218 '/api/pins/:requestid' ,
218- withAuth ( withMode ( pinsReplace , RW ) , {
219+ withAuth ( withMode ( pinsReplace , RWC ) , {
219220 checkHasPsaAccess,
220221 checkHasAccountRestriction,
221222 } ) ,
@@ -224,7 +225,7 @@ r.add(
224225r . add (
225226 'delete' ,
226227 '/api/pins/:requestid' ,
227- withAuth ( withMode ( pinsDelete , RW ) , {
228+ withAuth ( withMode ( pinsDelete , RWC ) , {
228229 checkHasDeleteRestriction,
229230 checkHasPsaAccess,
230231 } ) ,
@@ -238,13 +239,13 @@ r.add('get', '/api/:cid', withAuth(withMode(nftGet, RO)), [postCors])
238239r . add (
239240 'post' ,
240241 '/api/upload' ,
241- withAuth ( withMode ( nftUpload , RW ) , { checkUcan, checkHasAccountRestriction } ) ,
242+ withAuth ( withMode ( nftUpload , RWC ) , { checkUcan, checkHasAccountRestriction } ) ,
242243 [ postCors ]
243244)
244245r . add (
245246 'delete' ,
246247 '/api/:cid' ,
247- withAuth ( withMode ( nftDelete , RW ) , { checkHasDeleteRestriction } ) ,
248+ withAuth ( withMode ( nftDelete , RWC ) , { checkHasDeleteRestriction } ) ,
248249 [ postCors ]
249250)
250251
0 commit comments