feat(api): add POST /members
This commit is contained in:
parent
f2a298da75
commit
773f20d135
6 changed files with 249 additions and 14 deletions
|
@ -164,3 +164,27 @@ func (db *DB) WriteUserAvatar(ctx context.Context,
|
|||
|
||||
return webpInfo.Location, jpegInfo.Location, nil
|
||||
}
|
||||
|
||||
func (db *DB) WriteMemberAvatar(ctx context.Context,
|
||||
memberID xid.ID, webp io.Reader, jpeg io.Reader,
|
||||
) (
|
||||
webpLocation string,
|
||||
jpegLocation string,
|
||||
err error,
|
||||
) {
|
||||
webpInfo, err := db.minio.PutObject(ctx, db.minioBucket, "/members/"+memberID.String()+".webp", webp, -1, minio.PutObjectOptions{
|
||||
ContentType: "image/webp",
|
||||
})
|
||||
if err != nil {
|
||||
return "", "", errors.Wrap(err, "uploading webp avatar")
|
||||
}
|
||||
|
||||
jpegInfo, err := db.minio.PutObject(ctx, db.minioBucket, "/members/"+memberID.String()+".jpg", jpeg, -1, minio.PutObjectOptions{
|
||||
ContentType: "image/jpeg",
|
||||
})
|
||||
if err != nil {
|
||||
return "", "", errors.Wrap(err, "uploading jpeg avatar")
|
||||
}
|
||||
|
||||
return webpInfo.Location, jpegInfo.Location, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue