(attributes, options = {})
| 77 | // Returns the first record matching the given `where`, otherwise first in the |
| 78 | // whole table (whatever the DB determines is the first record) |
| 79 | static async findBy(attributes, options = {}) { |
| 80 | const record = await this.accessor.findFirst({ |
| 81 | where: attributes, |
| 82 | ...options, |
| 83 | }) |
| 84 | |
| 85 | return record ? await this.build(record) : null |
| 86 | } |
| 87 | |
| 88 | // Alias for findBy |
| 89 | static async first(...args) { |
no test coverage detected