This repository has been archived on 2024-04-05. You can view files and clone it, but cannot push or open issues/pull-requests.
score-tracker/database/scores/seasons.js

22 lines
398 B
JavaScript
Raw Normal View History

2021-11-21 04:52:32 +00:00
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);
}