Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions Modules/Account/moduleSrc/ORM/User.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ bool User::apiDELETE(DELETE_METHOD_ARGS_IMPL_APICALL)
return /*Targoman::API::Query::*/this->DeleteByPks(*this, DELETE_METHOD_CALL_ARGS_INTERNAL_CALL);
}

TAPI::RawData_t User::apiGETphoto(TAPI::JWT_t _JWT, quint64 _usrID)
TAPI::Base64Image_t User::apiGETphoto(TAPI::JWT_t _JWT, quint64 _usrID)
{
quint64 CurrentUserID = clsJWT(_JWT).usrID();

Expand All @@ -186,15 +186,7 @@ TAPI::RawData_t User::apiGETphoto(TAPI::JWT_t _JWT, quint64 _usrID)
.one()
.value(tblUserExtraInfo::ueiPhoto).toString().toLatin1();

QString Mime = "image/png";
QByteArray Image;
if (Photo.size() && Photo.startsWith("data:image/"))
{
Mime = Photo.split(';').first().mid(sizeof("data"));
Image = QByteArray::fromBase64(Photo.mid(Photo.indexOf("base64,") + sizeof ("base64,") - 1));
}

return TAPI::RawData_t(Image, Mime);
return TAPI::Base64Image_t(Photo);
}

bool User::apiUPDATEphoto(TAPI::JWT_t _JWT, TAPI::Base64Image_t _image)
Expand Down
4 changes: 2 additions & 2 deletions Modules/Account/moduleSrc/ORM/User.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ private slots:
bool ORMUPDATE("Update User info by priviledged user")
bool ORMDELETE("Delete a User by priviledged user")

TAPI::RawData_t REST_GET(
TAPI::Base64Image_t REST_GET(
photo,
(
TAPI::JWT_t _JWT,
quint64 _usrID
),
"Get user photo as image"
"Get user photo as base64"
)
bool REST_UPDATE(
photo,
Expand Down