|
| 1 | +/* |
| 2 | + # |
| 3 | + # Copyright (c) nexB Inc. and others. All rights reserved. |
| 4 | + # https://nexb.com and https://github.com/nexB/scancode-workbench/ |
| 5 | + # The ScanCode Workbench software is licensed under the Apache License version 2.0. |
| 6 | + # ScanCode is a trademark of nexB Inc. |
| 7 | + # |
| 8 | + # You may not use this software except in compliance with the License. |
| 9 | + # You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0 |
| 10 | + # Unless required by applicable law or agreed to in writing, software distributed |
| 11 | + # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 12 | + # CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 13 | + # specific language governing permissions and limitations under the License. |
| 14 | + # |
| 15 | + */ |
| 16 | + |
| 17 | +import { Sequelize, DataTypes, Model } from "sequelize"; |
| 18 | +import { jsonDataType } from "./databaseUtils"; |
| 19 | + |
| 20 | +export interface LicenseReferenceAttributes { |
| 21 | + id: number; |
| 22 | + key: string; |
| 23 | + language: string; |
| 24 | + short_name: string; |
| 25 | + name: string; |
| 26 | + category: string; |
| 27 | + owner: string; |
| 28 | + homepage_url: string; |
| 29 | + is_builtin: boolean; |
| 30 | + is_exception: boolean; |
| 31 | + is_unknown: boolean; |
| 32 | + is_generic: boolean; |
| 33 | + spdx_license_key: string; |
| 34 | + other_spdx_license_keys: string[]; |
| 35 | + osi_license_key: string; |
| 36 | + osi_url: string; |
| 37 | + // notes: string; |
| 38 | + // ignorable_copyrights: string[]; |
| 39 | + // ignorable_holders: string[]; |
| 40 | + // ignorable_authors: string[]; |
| 41 | + // ignorable_urls: string[]; |
| 42 | + // ignorable_emails: string[]; |
| 43 | + text: string; |
| 44 | + scancode_url: string; |
| 45 | + licensedb_url: string; |
| 46 | + spdx_url: string; |
| 47 | +} |
| 48 | + |
| 49 | +export default function licenseReferenceModel(sequelize: Sequelize) { |
| 50 | + return sequelize.define<Model<LicenseReferenceAttributes>>( |
| 51 | + "license_reference", |
| 52 | + { |
| 53 | + id: { |
| 54 | + allowNull: false, |
| 55 | + autoIncrement: true, |
| 56 | + primaryKey: true, |
| 57 | + type: DataTypes.INTEGER, |
| 58 | + }, |
| 59 | + key: DataTypes.STRING, |
| 60 | + language: DataTypes.STRING, |
| 61 | + short_name: DataTypes.STRING, |
| 62 | + name: DataTypes.STRING, |
| 63 | + category: DataTypes.STRING, |
| 64 | + owner: DataTypes.STRING, |
| 65 | + homepage_url: DataTypes.STRING, |
| 66 | + is_builtin: DataTypes.BOOLEAN, |
| 67 | + is_exception: DataTypes.BOOLEAN, |
| 68 | + is_unknown: DataTypes.BOOLEAN, |
| 69 | + is_generic: DataTypes.BOOLEAN, |
| 70 | + spdx_license_key: DataTypes.STRING, |
| 71 | + other_spdx_license_keys: jsonDataType("other_spdx_license_keys", []), |
| 72 | + osi_license_key: DataTypes.STRING, |
| 73 | + osi_url: DataTypes.STRING, |
| 74 | + // notes: DataTypes.STRING, |
| 75 | + // ignorable_copyrights: jsonDataType("ignorable_copyrights", []), |
| 76 | + // ignorable_holders: jsonDataType("ignorable_holders", []), |
| 77 | + // ignorable_authors: jsonDataType("ignorable_authors", []), |
| 78 | + // ignorable_urls: jsonDataType("ignorable_urls", []), |
| 79 | + // ignorable_emails: jsonDataType("ignorable_emails", []), |
| 80 | + text: DataTypes.STRING, |
| 81 | + scancode_url: DataTypes.STRING, |
| 82 | + licensedb_url: DataTypes.STRING, |
| 83 | + spdx_url: DataTypes.STRING, |
| 84 | + }, |
| 85 | + { |
| 86 | + timestamps: false, |
| 87 | + } |
| 88 | + ); |
| 89 | +} |
0 commit comments