22 lines
398 B
JavaScript
22 lines
398 B
JavaScript
|
const database = require('./../database');
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
class Season {
|
||
|
constructor(id, year) {
|
||
|
this.id = id;
|
||
|
this.year = year;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
async function create(year) {
|
||
|
const query = `INSERT INTO scores.seasons(school_year)
|
||
|
VALUES($1)
|
||
|
RETURNING season_id;`;
|
||
|
const id = (await database.executeQuery(query, [year]))[0][0];
|
||
|
return new Season(id, year);
|
||
|
}
|