Skip to content

Add Bytes type to Parse.Schema #1503

Closed
@MrMartinR

Description

@MrMartinR

New Issue Checklist

Issue Description

Is not possible to add a field using Bytes filetype.
VS Code throws an error on the 'Bytes' parameter
Argument of type '"Bytes"' is not assignable to parameter of type 'TYPE | undefined'.ts(2345)

Steps to reproduce

  const schema = new Parse.Schema('Contact')
  schema.addField('bytesField', 'Bytes')
  schema.update().then((result) => {
    console.log(result)
  })

I guess we need something like Parse-Swift feature.

Actual Outcome

On console.log Uncaught (in promise) Error: Bytes is not a valid type.

Expected Outcome

Not get the error and return the object

Environment

Local environment, using parse-server from the npm

Server

  • Parse Server version: latest
  • Operating system: macOS Monterrey
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

  • System (MongoDB or Postgres): Postgres
  • Database version: 14
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • Parse JS SDK version: latest

Logs

https://community.parseplatform.org/t/saving-byte-data-to-parseobject/1804/4
parse-community/Parse-Swift#190

it('works with bytes type', done => {
const object = new TestObject();
object.set('bytes', { __type: 'Bytes', base64: 'ZnJveW8=' });
object
.save()
.then(() => {
const query = new Parse.Query(TestObject);
return query.get(object.id);
})
.then(o => {
assert.equal(o.get('bytes').__type, 'Bytes');
assert.equal(o.get('bytes').base64, 'ZnJveW8=');
done();
});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions