How to use the @nozbe/watermelondb/RawRecord.sanitizedRaw function in @nozbe/watermelondb

To help you get started, we’ve selected a few @nozbe/watermelondb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RocketChat / Rocket.Chat.ReactNative / app / lib / database / helpers / messages.js View on Github external
await messageRecord.update((m) => {
				m._raw = sanitizedRaw({
					...m._raw,
					...message
				}, messagesCollection.schema);
				m.ts = message.ts;
			});
			// await action.subAction(() => messageRecord.deleteRoles());
github RocketChat / Rocket.Chat.ReactNative / app / lib / methods / getCustomEmojis.js View on Github external
emojisToCreate = emojisToCreate.map(emoji => emojisCollection.prepareCreate((e) => {
			e._raw = sanitizedRaw({ id: emoji._id }, emojisCollection.schema);
			Object.assign(e, emoji);
		}));
		emojisToUpdate = emojisToUpdate.map((emoji) => {
github RocketChat / Rocket.Chat.ReactNative / app / lib / methods / updateMessages.js View on Github external
msgsToCreate = msgsToCreate.map(message => msgCollection.prepareCreate(protectedFunction((m) => {
				m._raw = sanitizedRaw({ id: message._id }, msgCollection.schema);
				m.subscription.id = sub.id;
				Object.assign(m, message);
			})));
			threadsToCreate = threadsToCreate.map(thread => threadCollection.prepareCreate(protectedFunction((t) => {
github RocketChat / Rocket.Chat.ReactNative / app / lib / methods / sendFileMessage.js View on Github external
uploadRecord = await uploadsCollection.create((u) => {
							u._raw = sanitizedRaw({ id: fileInfo.path }, uploadsCollection.schema);
							Object.assign(u, fileInfo);
							u.subscription.id = rid;
						});
					});
github RocketChat / Rocket.Chat.ReactNative / app / lib / methods / getPermissions.js View on Github external
permissionsToCreate = permissionsToCreate.map(permission => permissionsCollection.prepareCreate(protectedFunction((p) => {
			p._raw = sanitizedRaw({ id: permission._id }, permissionsCollection.schema);
			Object.assign(p, permission);
		})));
		permissionsToUpdate = permissionsToUpdate.map((permission) => {
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / helpers / subscriptions.js View on Github external
subscriptionRecord = await subscriptionsCollection.create((s) => {
				s._raw = sanitizedRaw({
					...subscription
				}, subscriptionsCollection.schema);
				s.ts = subscription.ts;
				s.ls = subscription.ls;
				s.roomUpdatedAt = subscription.room_updated_at;
			});
		}