-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added two api endpoints i.e, create and update
Create License: to create an open-source license and add it to the database to make a license we need some required field Update License: to update an open-source license and modify it to database License to be updated using shortname
- Loading branch information
Showing
5 changed files
with
241 additions
and
19 deletions.
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// SPDX-FileCopyrightText: 2023 Kavya Shukla <[email protected]> | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
|
||
// Package models is made to connect the database and to store the structs of | ||
// different data. | ||
// Package models is made to store the structs of different data. | ||
package models |
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,37 @@ | ||
// SPDX-FileCopyrightText: 2023 Kavya Shukla <[email protected]> | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
|
||
package utils | ||
|
||
import "github.com/fossology/LicenseDb/pkg/models" | ||
|
||
func Converter(input models.LicenseJson) models.LicenseDB { | ||
if input.SpdxCompatible == "t" { | ||
input.SpdxCompatible = input.Shortname | ||
} else { | ||
input.SpdxCompatible = "LicenseRef-fossology-" + input.Shortname | ||
} | ||
result := models.LicenseDB{ | ||
Shortname: input.Shortname, | ||
Fullname: input.Fullname, | ||
Text: input.Text, | ||
Url: input.Fullname, | ||
Copyleft: input.Copyleft, | ||
AddDate: input.AddDate, | ||
FSFfree: input.FSFfree, | ||
OSIapproved: input.OSIapproved, | ||
GPLv2compatible: input.GPLv2compatible, | ||
GPLv3compatible: input.GPLv3compatible, | ||
Notes: input.Notes, | ||
Fedora: input.Fedora, | ||
TextUpdatable: input.TextUpdatable, | ||
DetectorType: input.DetectorType, | ||
Active: input.Active, | ||
Source: input.Source, | ||
SpdxId: input.SpdxCompatible, | ||
Risk: input.Risk, | ||
Flag: input.Flag, | ||
Marydone: input.Marydone, | ||
} | ||
return result | ||
} |