Mailspring/app/spec/fixtures/db-test-model.ts
Ben Gotow cff437e900
Upgrade to Electron 8, improve TS usage and TS errors outside calendar [requires re- npm install] (#2284)
* Shfit away from default exports and PropTypes for better TS support

* localize strings and expand use of types in WeekView, create new EventOccurence distinct from Event

* Remove calendar wrap, use TS enum for view type + consistent prop interface

* Bump Typescript to 3.8.3 and improve query / attribute / search typings

* Re-use the Autolinker for calendar event descriptions with aggressive phone detection

* Clean up WeekView and the editing popover, lots of cruft here

* Update ScrollRegion to initialize scrollbar provided by external ref

* Expose ScrollRegion’s resizeObserver to clean up tick interval tracking

* Simply tickGenerator and move it to a helper

* Bump to Electron 8.x for Chrome 75+ CSS features

* Bump Handlebars dep to fix annoying npm audit noise

* Remove electron-remote from electron-spellchecker

* Explicitly add node-gyp, why is this necessary?

* Fix lesslint issues

* Bump eslint and let it fix 133 issues

* Satisfy remaining eslint@2020 errors by hand

* Add tsc-watch npm script and fix all TS errors outside calendar

* Configure appveyor to publish all the pdb files it gets

* Log sync exit codes and signals for easier triage on Windows

* Upgrade npm, mark that the build process supports Node 11+ not just Node 11

* Resolve more errors

* Upgrade sqlite to be a context-aware native module

* Fix: Tab key no longer navigating into contenteditable because tabIndex not inferred

* Fix: Bad print styles because Chrome now adds more CSS of it’s own when doctype is missing

* Fix: before-navigate is now called after beforeunload
2021-02-14 15:58:22 -06:00

141 lines
3.2 KiB
TypeScript

/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
import { Model } from '../../src/flux/models/model';
import { Category } from '../../src/flux/models/category';
import * as Attributes from '../../src/flux/attributes';
class TestModel extends Model {
static attributes = {
...Model.attributes,
clientId: Attributes.String({
queryable: true,
modelKey: 'clientId',
jsonKey: 'client_id',
}),
serverId: Attributes.String({
queryable: true,
modelKey: 'serverId',
jsonKey: 'server_id',
}),
};
}
TestModel.configureBasic = () =>
(TestModel.attributes = {
id: Attributes.String({
queryable: true,
modelKey: 'id',
}),
clientId: Attributes.String({
queryable: true,
modelKey: 'clientId',
jsonKey: 'client_id',
}),
serverId: Attributes.String({
queryable: true,
modelKey: 'serverId',
jsonKey: 'server_id',
}),
});
TestModel.configureWithAllAttributes = () =>
(TestModel.attributes = {
datetime: Attributes.DateTime({
queryable: true,
modelKey: 'datetime',
}),
string: Attributes.String({
queryable: true,
modelKey: 'string',
jsonKey: 'string-json-key',
}),
boolean: Attributes.Boolean({
queryable: true,
modelKey: 'boolean',
}),
number: Attributes.Number({
queryable: true,
modelKey: 'number',
}),
other: Attributes.String({
modelKey: 'other',
}),
});
TestModel.configureWithCollectionAttribute = () =>
(TestModel.attributes = {
id: Attributes.String({
queryable: true,
modelKey: 'id',
}),
clientId: Attributes.String({
queryable: true,
modelKey: 'clientId',
jsonKey: 'client_id',
}),
serverId: Attributes.String({
queryable: true,
modelKey: 'serverId',
jsonKey: 'server_id',
}),
other: Attributes.String({
queryable: true,
modelKey: 'other',
}),
categories: Attributes.Collection({
queryable: true,
modelKey: 'categories',
itemClass: Category,
joinOnField: 'id',
joinQueryableBy: ['other'],
}),
});
TestModel.configureWithJoinedDataAttribute = function() {
TestModel.attributes = {
id: Attributes.String({
queryable: true,
modelKey: 'id',
}),
clientId: Attributes.String({
queryable: true,
modelKey: 'clientId',
jsonKey: 'client_id',
}),
serverId: Attributes.String({
queryable: true,
modelKey: 'serverId',
jsonKey: 'server_id',
}),
body: Attributes.JoinedData({
modelTable: 'TestModelBody',
modelKey: 'body',
}),
};
TestModel.attributes = {
id: Attributes.String({
queryable: true,
modelKey: 'id',
}),
clientId: Attributes.String({
modelKey: 'clientId',
jsonKey: 'client_id',
}),
serverId: Attributes.String({
modelKey: 'serverId',
jsonKey: 'server_id',
}),
body: Attributes.JoinedData({
modelTable: 'TestModelBody',
modelKey: 'body',
}),
};
};
export default TestModel;