• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

u-wave / core / 11980915260

22 Nov 2024 10:10PM UTC coverage: 78.492% (-1.7%) from 80.158%
11980915260

push

github

web-flow
Switch to a relational database (#637)

* It boots from SQL

* progress on loading playlists

* Use uppercase ID

* Search based on SQL media

* add userID to history entry schema

* stash

* Migrate history, read history

* Typed IDs; move mostly to new schema types

* Migrate authentication model to SQL

* Update unique constraints

* Fix lodash import

* Select the right stuff from users

* Use Object.groupBy

* Use order column for playlist sorting?

The other option is to have a JSON column with IDs on the playlists
table.

* Add linting for JSDoc

* SQL config store

* stash

* Bump kysely

* Different way to store playlist item order

* Opaque -> Tagged

* Port bans

* deps: update better-sqlite3

* Remove mongodb connection code

* Adding playlist items with sql?

* Revert "Remove mongodb connection code"

This reverts commit 8b2ae37e6.

* Make migrations work in sql

* Try with SQLite

* Migrate auth passwords

* Better Date support for SQLite

* Use json_each

* use json_array_length

* SQLite utility functions

* Fix property name in test

* playlist shuffle and cycle with sqlite

* Use a flat list of permissions

* Various test fixes

* Ban test sorta working

* small test fixes

* acl fixes

* some more json sqlite fixes

* serialize active playlist id

* Implement playlist updates with sql

* More JSON fun

* users test fixes

* test fixes for bans and /now

* finish redis connection before changing configs

* User avatar / roles return values

* test ID fix

* Fix playlist item serialization

* implement removing playlist items

* put comment

* Fix issues due to playlist position options

* disable sql query logging

* various sql booth fixes

* Test fixes by moving to new data structure

* Inline the email function

* Fix email test

* This map is a multi map

* fix playlist item filte... (continued)

757 of 912 branches covered (83.0%)

Branch coverage included in aggregate %.

2001 of 2791 new or added lines in 52 files covered. (71.69%)

9 existing lines in 7 files now uncovered.

8666 of 11093 relevant lines covered (78.12%)

70.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

8.89
/src/utils/Multimap.js
1
/**
1✔
2
 * A map with multiple values per key.
1✔
3
 *
1✔
4
 * @template K
1✔
5
 * @template T
1✔
6
 */
1✔
7
export default class Multimap {
1!
NEW
8
  /** @type {Map<K, T[]>} */
×
NEW
9
  #map = new Map();
×
NEW
10

×
NEW
11
  /**
×
NEW
12
   * Return true if the given key exists in the map.
×
NEW
13
   *
×
NEW
14
   * @param {K} key
×
NEW
15
   */
×
NEW
16
  has(key) {
×
NEW
17
    return this.#map.has(key);
×
NEW
18
  }
×
NEW
19

×
NEW
20
  /**
×
NEW
21
   * Get all values for a key.
×
NEW
22
   *
×
NEW
23
   * @param {K} key
×
NEW
24
   */
×
NEW
25
  get(key) {
×
NEW
26
    return this.#map.get(key);
×
NEW
27
  }
×
NEW
28

×
NEW
29
  /**
×
NEW
30
   * Add a key/value pair.
×
NEW
31
   *
×
NEW
32
   * @param {K} key
×
NEW
33
   * @param {T} value
×
NEW
34
   */
×
NEW
35
  set(key, value) {
×
NEW
36
    const existing = this.#map.get(key);
×
NEW
37
    if (existing) {
×
NEW
38
      existing.push(value);
×
NEW
39
    } else {
×
NEW
40
      this.#map.set(key, [value]);
×
NEW
41
    }
×
NEW
42
    return this;
×
NEW
43
  }
×
NEW
44

×
NEW
45
  /**
×
NEW
46
   * Delete all elements with a given key. Return true if any elements existed.
×
NEW
47
   *
×
NEW
48
   * @param {K} key
×
NEW
49
   */
×
NEW
50
  delete(key) {
×
NEW
51
    return this.#map.delete(key);
×
NEW
52
  }
×
NEW
53

×
NEW
54
  /**
×
NEW
55
   * Remove a specific element with a given key. Return true if it existed.
×
NEW
56
   *
×
NEW
57
   * @param {K} key
×
NEW
58
   * @param {T} value
×
NEW
59
   */
×
NEW
60
  remove(key, value) {
×
NEW
61
    const existing = this.#map.get(key);
×
NEW
62
    if (!existing) {
×
NEW
63
      return false;
×
NEW
64
    }
×
NEW
65

×
NEW
66
    // If this is the only element for the key, delete the whole key, so
×
NEW
67
    // we never have empty keys.
×
NEW
68
    if (existing.length === 1 && existing[0] === value) {
×
NEW
69
      return this.#map.delete(key);
×
NEW
70
    }
×
NEW
71

×
NEW
72
    const index = existing.indexOf(value);
×
NEW
73
    if (index === -1) {
×
NEW
74
      return false;
×
NEW
75
    }
×
NEW
76
    existing.splice(index, 1);
×
NEW
77
    return true;
×
NEW
78
  }
×
NEW
79

×
NEW
80
  /** Iterate over the keys in the map. */
×
NEW
81
  keys() {
×
NEW
82
    return this.#map.keys();
×
NEW
83
  }
×
NEW
84

×
NEW
85
  [Symbol.iterator]() {
×
NEW
86
    return this.#map.entries();
×
NEW
87
  }
×
NEW
88
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc