-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtypes.go
453 lines (405 loc) · 25.7 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
// SPDX-FileCopyrightText: 2023 Kavya Shukla <[email protected]>
// SPDX-FileCopyrightText: 2023 Siemens AG
// SPDX-FileContributor: Gaurav Mishra <[email protected]>
//
// SPDX-License-Identifier: GPL-2.0-only
package models
import (
"time"
"gorm.io/datatypes"
)
// The LicenseDB struct represents a license entity with various attributes and
// properties associated with it.
// It provides structured storage for license-related information.
type LicenseDB struct {
Id int64 `json:"rf_id" gorm:"primary_key;column:rf_id" example:"123"`
Shortname string `json:"rf_shortname" gorm:"unique;not null;column:rf_shortname" example:"MIT"`
Fullname string `json:"rf_fullname" gorm:"column:rf_fullname" example:"MIT License"`
Text string `json:"rf_text" gorm:"column:rf_text" example:"MIT License Text here"`
Url string `json:"rf_url" gorm:"column:rf_url" example:"https://opensource.org/licenses/MIT"`
AddDate time.Time `json:"rf_add_date" gorm:"default:CURRENT_TIMESTAMP;column:rf_add_date" example:"2023-12-01T18:10:25.00+05:30"`
Copyleft bool `json:"rf_copyleft" gorm:"column:rf_copyleft"`
FSFfree bool `json:"rf_FSFfree" gorm:"column:rf_FSFfree"`
OSIapproved bool `json:"rf_OSIapproved" gorm:"column:rf_OSIapproved"`
GPLv2compatible bool `json:"rf_GPLv2compatible" gorm:"column:rf_GPLv2compatible"`
GPLv3compatible bool `json:"rf_GPLv3compatible" gorm:"column:rf_GPLv3compatible"`
Notes string `json:"rf_notes" gorm:"column:rf_notes" example:"This license has been superseded."`
Fedora string `json:"rf_Fedora" gorm:"column:rf_Fedora"`
TextUpdatable bool `json:"rf_text_updatable" gorm:"column:rf_text_updatable"`
DetectorType int64 `json:"rf_detector_type" gorm:"column:rf_detector_type" example:"1"`
Active bool `json:"rf_active" gorm:"column:rf_active"`
Source string `json:"rf_source" gorm:"column:rf_source"`
SpdxId string `json:"rf_spdx_id" gorm:"column:rf_spdx_id" example:"MIT"`
Risk int64 `json:"rf_risk" gorm:"column:rf_risk"`
Flag int64 `json:"rf_flag" gorm:"default:1;column:rf_flag" example:"1"`
Marydone bool `json:"marydone" gorm:"column:marydone"`
ExternalRef datatypes.JSONType[LicenseDBSchemaExtension] `json:"external_ref"`
}
// LicensePOSTRequestJSONSchema struct represents the input or payload required for creating a license.
// It contains various fields that capture the necessary information for defining a license entity.
type LicensePOSTRequestJSONSchema struct {
Shortname string `json:"rf_shortname" binding:"required" example:"MIT"`
Fullname string `json:"rf_fullname" binding:"required" example:"MIT License"`
Text string `json:"rf_text" binding:"required" example:"MIT License Text here"`
Url string `json:"rf_url" binding:"required" example:"https://opensource.org/licenses/MIT"`
Copyleft bool `json:"rf_copyleft" binding:"required"`
FSFfree bool `json:"rf_FSFfree" binding:"required"`
OSIapproved bool `json:"rf_OSIapproved" binding:"required"`
GPLv2compatible bool `json:"rf_GPLv2compatible" binding:"required"`
GPLv3compatible bool `json:"rf_GPLv3compatible" binding:"required"`
Notes string `json:"rf_notes" example:"This license has been superseded." binding:"required"`
Fedora string `json:"rf_Fedora" binding:"required"`
TextUpdatable bool `json:"rf_text_updatable" binding:"required"`
DetectorType int64 `json:"rf_detector_type" example:"1" binding:"required"`
Active bool `json:"rf_active" binding:"required"`
Source string `json:"rf_source" binding:"required"`
SpdxId string `json:"rf_spdx_id" binding:"required" example:"MIT"`
Risk int64 `json:"rf_risk" binding:"required"`
Flag int64 `json:"rf_flag" binding:"required" example:"1"`
Marydone bool `json:"marydone" binding:"required"`
ExternalRef datatypes.JSONType[LicenseDBSchemaExtension] `json:"external_ref" binding:"required"`
}
type ExportLicenseDB struct {
Shortname string `json:"rf_shortname" gorm:"unique;not null;column:rf_shortname" example:"MIT"`
Fullname string `json:"rf_fullname" gorm:"column:rf_fullname" example:"MIT License"`
Text string `json:"rf_text" gorm:"column:rf_text" example:"MIT License Text here"`
Url string `json:"rf_url" gorm:"column:rf_url" example:"https://opensource.org/licenses/MIT"`
AddDate time.Time `json:"rf_add_date" gorm:"default:CURRENT_TIMESTAMP;column:rf_add_date" example:"2023-12-01T18:10:25.00+05:30"`
Copyleft bool `json:"rf_copyleft" gorm:"column:rf_copyleft"`
FSFfree bool `json:"rf_FSFfree" gorm:"column:rf_FSFfree"`
OSIapproved bool `json:"rf_OSIapproved" gorm:"column:rf_OSIapproved"`
GPLv2compatible bool `json:"rf_GPLv2compatible" gorm:"column:rf_GPLv2compatible"`
GPLv3compatible bool `json:"rf_GPLv3compatible" gorm:"column:rf_GPLv3compatible"`
Notes string `json:"rf_notes" gorm:"column:rf_notes" example:"This license has been superseded."`
Fedora string `json:"rf_Fedora" gorm:"column:rf_Fedora"`
TextUpdatable bool `json:"rf_text_updatable" gorm:"column:rf_text_updatable"`
DetectorType int64 `json:"rf_detector_type" gorm:"column:rf_detector_type" example:"1"`
Active bool `json:"rf_active" gorm:"column:rf_active"`
Source string `json:"rf_source" gorm:"column:rf_source"`
SpdxId string `json:"rf_spdx_id" gorm:"column:rf_spdx_id" example:"MIT"`
Risk int64 `json:"rf_risk" gorm:"column:rf_risk"`
Flag int64 `json:"rf_flag" gorm:"default:1;column:rf_flag" example:"1"`
Marydone bool `json:"marydone" gorm:"column:marydone"`
ExternalRef datatypes.JSONType[LicenseDBSchemaExtension] `json:"external_ref"`
}
type LicenseJson struct {
Shortname string `json:"rf_shortname"`
Fullname string `json:"rf_fullname"`
Text string `json:"rf_text"`
Url string `json:"rf_url"`
AddDate string `json:"rf_add_date"`
Copyleft string `json:"rf_copyleft"`
FSFfree string `json:"rf_FSFfree"`
OSIapproved string `json:"rf_OSIapproved"`
GPLv2compatible string `json:"rf_GPLv2compatible"`
GPLv3compatible string `json:"rf_GPLv3compatible"`
Notes string `json:"rf_notes"`
Fedora string `json:"rf_Fedora"`
TextUpdatable string `json:"rf_text_updatable"`
DetectorType int64 `json:"rf_detector_type"`
Active string `json:"rf_active"`
Source string `json:"rf_source"`
SpdxCompatible string `json:"rf_spdx_compatible"`
Risk string `json:"rf_risk"`
Flag string `json:"rf_flag"`
Marydone string `json:"marydone"`
}
// LicensePATCHRequestJSONSchema struct represents the input format for updating an existing license.
// Note that the license ID and shortname cannot be updated.
type LicensePATCHRequestJSONSchema struct {
Fullname OptionalData[string] `json:"rf_fullname" swaggertype:"string" example:"MIT License"`
Text OptionalData[string] `json:"rf_text" swaggertype:"string" example:"MIT License Text here"`
Url OptionalData[string] `json:"rf_url" swaggertype:"string" example:"https://opensource.org/licenses/MIT"`
Copyleft OptionalData[bool] `json:"rf_copyleft" swaggertype:"boolean"`
FSFfree OptionalData[bool] `json:"rf_FSFfree" swaggertype:"boolean"`
OSIapproved OptionalData[bool] `json:"rf_OSIapproved" swaggertype:"boolean"`
GPLv2compatible OptionalData[bool] `json:"rf_GPLv2compatible" swaggertype:"boolean"`
GPLv3compatible OptionalData[bool] `json:"rf_GPLv3compatible" swaggertype:"boolean"`
Notes OptionalData[string] `json:"rf_notes" example:"This license has been superseded." swaggertype:"string"`
Fedora OptionalData[string] `json:"rf_Fedora" swaggertype:"string"`
TextUpdatable OptionalData[bool] `json:"rf_text_updatable" swaggertype:"boolean"`
DetectorType OptionalData[int64] `json:"rf_detector_type" example:"1" swaggertype:"integer"`
Active OptionalData[bool] `json:"rf_active" swaggertype:"boolean"`
Source OptionalData[string] `json:"rf_source" swaggertype:"string"`
SpdxId OptionalData[string] `json:"rf_spdx_id" example:"MIT" swaggertype:"string"`
Risk OptionalData[int64] `json:"rf_risk" swaggertype:"integer" example:"3"`
Flag OptionalData[int64] `json:"rf_flag" example:"1" swaggertype:"integer"`
Marydone OptionalData[bool] `json:"marydone" swaggertype:"boolean"`
ExternalRef map[string]interface{} `json:"external_ref"`
}
// LicensePreviewResponse gets us the list of all license shortnames
type LicensePreviewResponse struct {
Status int `json:"status" example:"200"`
Shortnames []string `json:"shortnames" example:"GPL-2.0-only,GPL-2.0-or-later"`
}
// LicenseImport represents an license record in the import json file.
type LicenseImport struct {
Shortname NullableAndOptionalData[string] `json:"rf_shortname" validate:"required" example:"MIT"`
Fullname NullableAndOptionalData[string] `json:"rf_fullname" validate:"required" example:"MIT License"`
Text NullableAndOptionalData[string] `json:"rf_text" validate:"required" example:"MIT License Text here"`
Url NullableAndOptionalData[string] `json:"rf_url" validate:"required" example:"https://opensource.org/licenses/MIT"`
Copyleft NullableAndOptionalData[bool] `json:"rf_copyleft"`
FSFfree NullableAndOptionalData[bool] `json:"rf_FSFfree"`
OSIapproved NullableAndOptionalData[bool] `json:"rf_OSIapproved"`
GPLv2compatible NullableAndOptionalData[bool] `json:"rf_GPLv2compatible"`
GPLv3compatible NullableAndOptionalData[bool] `json:"rf_GPLv3compatible"`
Notes NullableAndOptionalData[string] `json:"rf_notes" example:"This license has been superseded."`
Fedora NullableAndOptionalData[string] `json:"rf_Fedora"`
TextUpdatable NullableAndOptionalData[bool] `json:"rf_text_updatable" validate:"required"`
DetectorType NullableAndOptionalData[int64] `json:"rf_detector_type" example:"1"`
Active NullableAndOptionalData[bool] `json:"rf_active" validate:"required"`
Source NullableAndOptionalData[string] `json:"rf_source" validate:"required"`
SpdxId NullableAndOptionalData[string] `json:"rf_spdx_id" validate:"required" example:"MIT"`
Risk NullableAndOptionalData[int64] `json:"rf_risk" validate:"required"`
Flag NullableAndOptionalData[int64] `json:"rf_flag"`
Marydone NullableAndOptionalData[bool] `json:"marydone"`
ExternalRef map[string]interface{} `json:"external_ref"`
}
// LicenseImportStatusCode is internally used for checking status of a license import
type LicenseImportStatusCode int
// Status codes covering various scenarios that can occur on a license import
const (
IMPORT_FAILED LicenseImportStatusCode = iota + 1
IMPORT_LICENSE_CREATED
IMPORT_LICENSE_UPDATED
IMPORT_LICENSE_UPDATED_EXCEPT_TEXT
)
// LicenseId is the id of successfully imported license
type LicenseId struct {
Id int64 `json:"id" example:"31"`
Shortname string `json:"shortname" example:"MIT"`
}
// LicenseImportStatus is the status of license records successfully inserted in the database during import
type LicenseImportStatus struct {
Status int `json:"status" example:"200"`
Data LicenseId `json:"data"`
}
// ImportObligationsResponse is the response structure for import obligation response
type ImportLicensesResponse struct {
Status int `json:"status" example:"200"`
Data []interface{} `json:"data"` // can be of type models.LicenseError or models.LicenseImportStatus
}
// The PaginationMeta struct represents additional metadata associated with a
// license retrieval operation.
// It contains information that provides context and supplementary details
// about the retrieved license data.
type PaginationMeta struct {
ResourceCount int `json:"resource_count" example:"200"`
TotalPages int64 `json:"total_pages,omitempty" example:"20"`
Page int64 `json:"page,omitempty" example:"10"`
Limit int64 `json:"limit,omitempty" example:"10"`
Next string `json:"next,omitempty" example:"/api/v1/licenses?limit=10&page=11"`
Previous string `json:"previous,omitempty" example:"/api/v1/licenses?limit=10&page=9"`
}
// The PaginationInput struct represents the input required for pagination.
type PaginationInput struct {
Page int64 `json:"page" example:"10"`
Limit int64 `json:"limit" example:"10"`
}
// PaginationParse interface processes the pagination input.
type PaginationParse interface {
GetOffset() int
GetLimit() int
}
// GetOffset returns the offset value for gorm.
func (p PaginationInput) GetOffset() int64 {
return (p.Page - 1) * p.Limit
}
// GetLimit returns the limit value for gorm.
func (p PaginationInput) GetLimit() int64 {
return p.Limit
}
// LicenseResponse struct is representation of design API response of license.
// The LicenseResponse struct represents the response data structure for
// retrieving license information.
// It is used to encapsulate license-related data in an organized manner.
type LicenseResponse struct {
Status int `json:"status" example:"200"`
Data []LicenseDB `json:"data"`
Meta *PaginationMeta `json:"paginationmeta"`
}
// The LicenseError struct represents an error response related to license operations.
// It provides information about the encountered error, including details such as
// status, error message, error type, path, and timestamp.
type LicenseError struct {
Status int `json:"status" example:"400"`
Message string `json:"message" example:"invalid request body"`
Error string `json:"error" example:"invalid request body"`
Path string `json:"path" example:"/api/v1/licenses"`
Timestamp string `json:"timestamp" example:"2023-12-01T10:00:51+05:30"`
}
// User struct is representation of user information.
type User struct {
Id int64 `json:"id" gorm:"primary_key" example:"123"`
Username string `json:"username" gorm:"unique;not null" binding:"required" example:"fossy"`
Userlevel string `json:"userlevel" binding:"required" example:"admin"`
Userpassword *string `json:"-"`
}
type UserInput struct {
Username string `json:"username" gorm:"unique;not null" binding:"required" example:"fossy"`
Userlevel string `json:"userlevel" binding:"required" example:"admin"`
Userpassword *string `json:"password,omitempty" binding:"required" example:"fossy"`
}
type UserLogin struct {
Username string `json:"username" binding:"required" example:"fossy"`
Userpassword string `json:"password" binding:"required" example:"fossy"`
}
// UserResponse struct is representation of design API response of user.
type UserResponse struct {
Status int `json:"status" example:"200"`
Data []User `json:"data"`
Meta *PaginationMeta `json:"paginationmeta"`
}
// SearchLicense struct represents the input needed to search in a license.
type SearchLicense struct {
Field string `json:"field" binding:"required" example:"rf_text"`
SearchTerm string `json:"search_term" binding:"required" example:"MIT License"`
Search string `json:"search" enums:"fuzzy,full_text_search"`
}
// Audit struct represents an audit entity with certain attributes and properties
// It has user id as a foreign key
type Audit struct {
Id int64 `json:"id" gorm:"primary_key" example:"456"`
UserId int64 `json:"user_id" example:"123"`
User User `gorm:"foreignKey:UserId;references:Id" json:"user"`
Timestamp time.Time `json:"timestamp" example:"2023-12-01T18:10:25.00+05:30"`
Type string `json:"type" enums:"obligation,license" example:"license"`
TypeId int64 `json:"type_id" example:"34"`
Entity interface{} `json:"entity" gorm:"-" swaggertype:"object"`
ChangeLogs []ChangeLog `json:"-"`
}
// ChangeLog struct represents a change entity with certain attributes and properties
type ChangeLog struct {
Id int64 `json:"id" gorm:"primary_key" example:"789"`
Field string `json:"field" example:"rf_text"`
UpdatedValue *string `json:"updated_value" example:"New license text"`
OldValue *string `json:"old_value" example:"Old license text"`
AuditId int64 `json:"audit_id" example:"456"`
Audit Audit `gorm:"foreignKey:AuditId;references:Id" json:"-"`
}
// ChangeLogResponse represents the design of API response of change log
type ChangeLogResponse struct {
Status int `json:"status" example:"200"`
Data []ChangeLog `json:"data"`
Meta PaginationMeta `json:"paginationmeta"`
}
// AuditResponse represents the response format for audit data.
type AuditResponse struct {
Status int `json:"status" example:"200"`
Data []Audit `json:"data"`
Meta *PaginationMeta `json:"paginationmeta"`
}
// Obligation represents an obligation record in the database.
type Obligation struct {
Id int64 `gorm:"primary_key" json:"id" example:"147"`
Topic string `gorm:"unique" json:"topic" example:"copyleft"`
Type string `json:"type" enums:"obligation,restriction,risk,right" example:"risk"`
Text string `json:"text" example:"Source code be made available when distributing the software."`
Classification string `json:"classification" enums:"green,white,yellow,red" example:"green"`
Modifications bool `json:"modifications" example:"true"`
Comment string `json:"comment"`
Active bool `json:"active"`
TextUpdatable bool `json:"text_updatable" example:"true"`
Md5 string `gorm:"unique" json:"-"`
}
// ObligationPreview is just the Type and Topic of Obligation
type ObligationPreview struct {
Topic string `json:"topic" example:"Provide Copyright Notices"`
Type string `json:"type" enums:"obligation,restriction,risk,right"`
}
// ObligationResponse represents the response format for obligation data.
type ObligationPreviewResponse struct {
Status int `json:"status" example:"200"`
Data []ObligationPreview `json:"data"`
}
// ObligationPOSTRequestJSONSchema represents the data format of POST request for obligation
type ObligationPOSTRequestJSONSchema struct {
Topic string `json:"topic" binding:"required" example:"copyleft"`
Type string `json:"type" enums:"obligation,restriction,risk,right" binding:"required"`
Text string `json:"text" binding:"required" example:"Source code be made available when distributing the software."`
Classification string `json:"classification" enums:"green,white,yellow,red" binding:"required"`
Modifications bool `json:"modifications" binding:"required"`
Comment string `json:"comment" binding:"required"`
Shortnames []string `json:"shortnames" binding:"required" example:"GPL-2.0-only,GPL-2.0-or-later"`
Active bool `json:"active" binding:"required" example:"true"`
}
// ObligationPATCHRequestJSONSchema represents the data format of PATCH request for obligation
type ObligationPATCHRequestJSONSchema struct {
Type OptionalData[string] `json:"type" swaggertype:"string" enums:"obligation,restriction,risk,right"`
Text OptionalData[string] `json:"text" swaggertype:"string" example:"Source code be made available when distributing the software."`
Classification OptionalData[string] `json:"classification" swaggertype:"string" enums:"green,white,yellow,red"`
Modifications OptionalData[bool] `json:"modifications" swaggertype:"boolean"`
Comment OptionalData[string] `json:"comment" swaggertype:"string" example:"This is a comment."`
Active OptionalData[bool] `json:"active" swaggertype:"boolean" example:"true"`
TextUpdatable OptionalData[bool] `json:"text_updatable" swaggertype:"boolean"`
}
// ObligationResponse represents the response format for obligation data.
type ObligationResponse struct {
Status int `json:"status" example:"200"`
Data []Obligation `json:"data"`
Meta *PaginationMeta `json:"paginationmeta"`
}
// ObligationMap represents the mapping between an obligation and a license.
type ObligationMap struct {
ObligationPk int64 `json:"obligation_pk"`
Obligation Obligation `gorm:"foreignKey:ObligationPk;references:Id" json:"-"`
OmPk int64 `json:"om_pk" gorm:"primary_key"`
RfPk int64 `json:"rf_pk"`
LicenseDB LicenseDB `gorm:"foreignKey:RfPk;references:Id" json:"-"`
}
// ObligationMapUser Structure with obligation topic and license shortname list, a simple representation for user.
type ObligationMapUser struct {
Topic string `json:"topic" example:"copyleft"`
Type string `json:"type" example:"obligation" enums:"obligation,restriction,risk,right"`
Shortnames []string `json:"shortnames" example:"GPL-2.0-only,GPL-2.0-or-later"`
}
// LicenseShortnamesInput represents the input format for adding/removing licenses from obligation map.
type LicenseShortnamesInput struct {
Shortnames []string `json:"shortnames" example:"GPL-2.0-only,GPL-2.0-or-later"`
}
// LicenseMapShortnamesElement Element to hold license shortname and action
type LicenseMapShortnamesElement struct {
Shortname string `json:"shortname" example:"GPL-2.0-only"`
Add bool `json:"add" example:"true"`
}
// LicenseMapShortnamesInput List of elements to be read as input by API
type LicenseMapShortnamesInput struct {
MapInput []LicenseMapShortnamesElement `json:"map"`
}
// ObligationMapResponse response format for obligation map data.
type ObligationMapResponse struct {
Status int `json:"status" example:"200"`
Data []ObligationMapUser `json:"data"`
Meta PaginationMeta `json:"paginationmeta"`
}
// ObligationImportRequest represents the request body structure for import obligation
type ObligationImportRequest struct {
ObligationFile string `form:"file"`
}
// ObligationJSONFileFormat represents an obligation record in the import/export json file.
type ObligationJSONFileFormat struct {
Topic string `json:"topic" example:"copyleft" validate:"required"` // binding:"required" tag cannot be used as is works only for request body
Type string `json:"type" enums:"obligation,restriction,risk,right" validate:"required"`
Text string `json:"text" example:"Source code be made available when distributing the software." validate:"required"`
Classification string `json:"classification" enums:"green,white,yellow,red" validate:"required"`
Modifications bool `json:"modifications" validate:"required"`
Comment string `json:"comment" example:"This is a comment." validate:"required"`
Active bool `json:"active" validate:"required"`
TextUpdatable bool `json:"text_updatable" validate:"required"`
Shortnames []string `json:"shortnames" example:"GPL-2.0-only,GPL-2.0-or-later" validate:"required"`
}
// ObligationId is the id of successfully imported obligation
type ObligationId struct {
Id int64 `json:"id" example:"31"`
Topic string `json:"topic" example:"copyleft"`
}
// ObligationImportStatus is the status of obligation records successfully inserted in the database during import
type ObligationImportStatus struct {
Status int `json:"status" example:"200"`
Data ObligationId `json:"data"`
}
// ImportObligationsResponse is the response structure for import obligation response
type ImportObligationsResponse struct {
Status int `json:"status" example:"200"`
Data []interface{} `json:"data"` // can be of type models.LicenseError or models.ObligationImportStatus
}