Files
popiart-server/internal/server/repository.go
T
wtgoku baba209519 Expose gateway billing flows from the synced server baseline
The preserved local work adds PopiNewAPI billing checkout, gateway account binding, and matching web console/pricing surfaces on top of the current test-server baseline. During the merge, the start-end video helpers from the deployed baseline were kept alongside the actionGenerate prompt handling from the WIP.

Constraint: Current usable baseline is 7054436, already deployed on the test server.

Rejected: Commit the WIP before syncing the baseline | would have hidden conflicts with the deployed start-end-frame changes.

Confidence: medium

Scope-risk: broad

Directive: Do not deploy this commit to the test server without rechecking gateway credentials and billing checkout behavior in that environment.

Tested: go test ./...

Tested: make build

Tested: cd web && npm run build
2026-05-21 16:53:07 +08:00

40 lines
1.5 KiB
Go

package server
import "time"
type SessionRepository interface {
CreateSession(upstreamKey string, u user, ttl time.Duration) (session, error)
GetSession(token string) (session, bool, error)
DeleteSession(token string) error
RotateSession(oldToken string, ttl time.Duration) (session, bool, error)
UpdateSessionGatewayBinding(token string, gatewayUserID int, gatewayAccessToken string) error
}
type JobRepository interface {
CreateJob(record *job) (*job, int, error)
GetJob(jobID string) (*job, bool, error)
ListJobs(userID, status, skillID, projectID string, limit, offset int) ([]job, int, error)
MarkJobRunning(jobID string) (*job, bool, error)
LinkUpstreamTask(jobID, upstreamTaskID string) error
FailJob(jobID, code, message string, details map[string]any) error
CompleteSyncResult(jobID string, refs []resultRef, usage map[string]any) error
CancelJob(userID, jobID string) (*job, bool, bool, error)
}
type RouteRepository interface {
GetRoutes(projectID string) (map[string]string, error)
SetRoute(projectID, routeKey, modelID string) error
UnsetRoute(projectID, routeKey string) error
}
type MediaRepository interface {
UpsertMedia(record mediaRecord) error
GetMedia(mediaID string) (*mediaRecord, bool, error)
}
type ArtifactRepository interface {
UpsertArtifacts(userID, projectID string, items []artifact) error
GetArtifact(userID, artifactID string) (*artifact, resultRef, bool, error)
ListArtifacts(userID, projectID, jobID string, limit, offset int) ([]artifact, int, error)
}