kossnocorp / typesaurus

🦕 Type-safe TypeScript-first ODM for Firestore
https://typesaurus.com
415 stars 36 forks source link

Support for passing in databaseID to schema #139

Open ecaroth opened 3 months ago

ecaroth commented 3 months ago

This small PR adds support for optionally including a databaseId in your schema config, like so:

schema(($) => ({
            foor: $.collection<Foo>().sub({
                bar: $.collection<Bar>(),
            })
        }), {
            databaseId: 'my-database-id',
            // optionally specify unique databaseId for client or server options
            server: {app, databaseId: 'my-database-id'},
            client: {app, databaseId, databaseId: 'my-database-id'}
        }
    )

Other notes: Fixed a very small bug with unit test for averages and small errors with Options typing also