Skip to content

Add enrollments database table to track learner course registrations #328

@Anuoluwapo25

Description

@Anuoluwapo25

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

  • server/src/db/index.ts

Labels

backend, good first issue, help wanted, Stellar Wave

Metadata

Metadata

Assignees

Labels

backendAPI/database/infrastructuregood first issueGood for newcomershelp wantedExtra attention is needed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions