forked from OneUptime/oneuptime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Add CodeRepository model, service, and permissions
This code change adds the CodeRepository model, service, and permissions to the project. It includes the following modifications: - Added CodeRepository model to the Models/Index.ts file. - Added CodeRepositoryService to the Services/Index.ts file. - Created CodeRepositoryService.ts file with the necessary implementation. - Updated Permission enum in the Permission.ts file to include CreateCodeRepository, DeleteCodeRepository, EditCodeRepository, and ReadCodeRepository permissions. These changes enable the project to manage code repositories and define the necessary permissions for them.
- Loading branch information
Showing
6 changed files
with
586 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import PostgresDatabase from '../Infrastructure/PostgresDatabase'; | ||
import CreateBy from '../Types/Database/CreateBy'; | ||
import { OnCreate } from '../Types/Database/Hooks'; | ||
import DatabaseService from './DatabaseService'; | ||
import ObjectID from 'Common/Types/ObjectID'; | ||
import Model from 'Model/Models/CodeRepository'; | ||
|
||
export class Service extends DatabaseService<Model> { | ||
public constructor(postgresDatabase?: PostgresDatabase) { | ||
super(Model, postgresDatabase); | ||
} | ||
|
||
protected override async onBeforeCreate( | ||
createBy: CreateBy<Model> | ||
): Promise<OnCreate<Model>> { | ||
createBy.data.secretToken = ObjectID.generate(); | ||
|
||
return { | ||
carryForward: null, | ||
createBy: createBy, | ||
}; | ||
} | ||
} | ||
|
||
export default new Service(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.