Description
The enrollments endpoint (issue #295) needs a database table to record which learners are enrolled in which courses. Currently enrollment is only tracked on-chain with no backend copy for fast queries.
What Needs to Be Done
Add to server/src/db/index.ts:
CREATE TABLE IF NOT EXISTS enrollments (
id SERIAL PRIMARY KEY,
learner_address TEXT NOT NULL,
course_id TEXT NOT NULL REFERENCES courses(id),
tx_hash TEXT,
enrolled_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(learner_address, course_id)
);
Files Affected
Labels
backend, good first issue, help wanted, Stellar Wave
Description
The enrollments endpoint (issue #295) needs a database table to record which learners are enrolled in which courses. Currently enrollment is only tracked on-chain with no backend copy for fast queries.
What Needs to Be Done
Add to server/src/db/index.ts:
CREATE TABLE IF NOT EXISTS enrollments (
id SERIAL PRIMARY KEY,
learner_address TEXT NOT NULL,
course_id TEXT NOT NULL REFERENCES courses(id),
tx_hash TEXT,
enrolled_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(learner_address, course_id)
);
Files Affected
Labels
backend, good first issue, help wanted, Stellar Wave