Add servers.lastLocalAuthenticatedSession column

This commit is contained in:
Diego Mello 2020-04-14 10:30:55 -03:00
parent f8656694bb
commit dc59232305
4 changed files with 20 additions and 2 deletions

View File

@ -17,4 +17,6 @@ export default class Server extends Model {
@date('rooms_updated_at') roomsUpdatedAt;
@field('version') version;
@date('last_local_authenticated_session') lastLocalAuthenticatedSession;
}

View File

@ -12,6 +12,17 @@ export default schemaMigrations({
]
})
]
},
{
toVersion: 4,
steps: [
addColumns({
table: 'servers',
columns: [
{ name: 'last_local_authenticated_session', type: 'number', isOptional: true }
]
})
]
}
]
});

View File

@ -1,7 +1,7 @@
import { appSchema, tableSchema } from '@nozbe/watermelondb';
export default appSchema({
version: 3,
version: 4,
tables: [
tableSchema({
name: 'users',
@ -24,7 +24,8 @@ export default appSchema({
{ name: 'file_upload_media_type_white_list', type: 'string', isOptional: true },
{ name: 'file_upload_max_file_size', type: 'number', isOptional: true },
{ name: 'rooms_updated_at', type: 'number', isOptional: true },
{ name: 'version', type: 'string', isOptional: true }
{ name: 'version', type: 'string', isOptional: true },
{ name: 'last_local_authenticated_session', type: 'number', isOptional: true }
]
})
]

View File

@ -14,6 +14,10 @@ const localAuthenticate = async(server) => {
return Promise.reject();
}
// if (serverRecord?.lastLocalAuthenticatedSession) {
// }
const authResult = await LocalAuthentication.authenticateAsync();
return Promise.resolve(authResult?.success);
};