create public build endpoint
All checks were successful
App Image CI / Build app image (pull_request) Successful in -1m26s
NPM Audit Check / Check NPM audit (pull_request) Successful in -2m14s

This commit is contained in:
2025-09-23 19:15:19 -05:00
parent b20bbf40fc
commit 77441fe7ed
5 changed files with 108 additions and 62 deletions

View File

@@ -25,6 +25,7 @@ interface Build {
status: Status;
pid?: number;
sqid?: string;
uuid: string;
}
interface User {
@@ -105,6 +106,10 @@ class DB {
pid: {
type: DataTypes.INTEGER,
allowNull: true
},
uuid: {
type: DataTypes.STRING,
unique: true
}
});
@@ -182,13 +187,14 @@ class DB {
return user.id;
}
public async createBuild(repo: string, commit: string, patch: string, distro: string, dependencies: string, author: string): Promise<number> {
public async createBuild(repo: string, commit: string, patch: string, distro: string, dependencies: string, author: string, uuid: string): Promise<number> {
const buildRec = await this.build.create({
repo,
commit: commit || null,
patch: patch || null,
distro,
dependencies,
uuid,
userId: author || '-1'
});
return buildRec.id;
@@ -241,6 +247,15 @@ class DB {
});
}
public async getBuildByUuid(uuid: string): Promise<Build> {
return await this.build.findOne({
where: {
uuid
},
include: this.user
});
}
public async getBuilds(): Promise<Build[]> {
return await this.build.findAll({
attributes: SELECT,