Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
43c0fd2e
authored
Oct 16, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
picto upload now is an update
parent
ca165925
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
18 deletions
sails/src/api/controllers/PictoController.js
sails/src/api/controllers/PictoController.js
View file @
43c0fd2e
...
...
@@ -563,23 +563,37 @@ module.exports = {
if
(
err
||
(
uploadedFiles
.
length
===
0
))
return
res
.
serverError
(
"Error uploading "
+
err
?
err
:
""
);
Picto
.
create
({
uri
:
pictoFileName
,
source
:
2
,
// 1 -> SymbolStix, 2 -> custom
owner
:
supervisor
.
id
})
.
then
(
picto
=>
{
return
res
.
ok
(
picto
);
})
.
catch
(
err
=>
{
fs
.
unlink
(
uploadedFiles
[
0
].
fd
);
return
res
.
serverError
(
"Error uploading "
+
err
);
});
});
})
.
catch
(
function
(
err
)
{
return
res
.
serverError
(
"Error uploading picto: "
+
err
);
});
if
(
req
.
body
.
id_pic
!=
null
&&
req
.
body
.
id
>=
0
)
{
query
=
{
id
:
req
.
body
.
id_pic
}
Picto
.
update
(
query
,
{
uri
:
pictoFileName
})
.
then
(
updated
=>
{
return
res
.
ok
(
updated
);
})
.
catch
(
err
=>
{
return
res
.
serverError
(
'Unable to upload picto: '
+
err
);
});
}
else
Picto
.
create
({
uri
:
pictoFileName
,
source
:
2
,
// 1 -> SymbolStix, 2 -> custom
owner
:
supervisor
.
id
})
.
then
(
picto
=>
{
return
res
.
ok
(
picto
);
})
.
catch
(
err
=>
{
fs
.
unlink
(
uploadedFiles
[
0
].
fd
);
return
res
.
serverError
(
"Error uploading "
+
err
);
});
});
})
.
catch
(
function
(
err
)
{
return
res
.
serverError
(
"Error uploading picto: "
+
err
);
});
}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment