This file contains hidden or 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
| @PutMapping("/{id}") | |
| fun update(@PathVariable("id") id: Long, @RequestBody itemDto: CreateItemDto) { | |
| itemRepository.update(id, itemDto) { | |
| it.updatedOn = LocalDateTime.now() | |
| } | |
| } | |
| fun update(id: Long, dto: Any, change: Consumer<R>) { | |
| val record : R = dsl.newRecord(table, dto) | |
| change.accept (record) |
This file contains hidden or 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
| fun update(id: Long, updatedRecord: R) { | |
| val count = dsl.update(table) | |
| .set(updatedRecord) | |
| .where(idField.eq(id)) | |
| .execute() | |
| if (count != 1) throw NotFoundException("No record was updated") | |
| } |
This file contains hidden or 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
| abstract class CrudRepository<R : Record>(open val dsl: DSLContext, | |
| open val table: Table<R>, | |
| open val idField: TableField<R, Long?>) { |
This file contains hidden or 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
| jooq { | |
| version.set("3.16.7") | |
| edition.set(JooqEdition.OSS) | |
| configurations { | |
| create("main") { | |
| jooqConfiguration.apply { | |
| logging = Logging.WARN | |
| jdbc.apply { | |
| driver = "org.postgresql.Driver" |
This file contains hidden or 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
| : Fetched result : +----+-------+-----------+------------------+------------+------------------+--------------------------+--------------------------+--------------+--------------------+------+----------+ | |
| : : | id|home_id|category_id|created_by_user_id|name |description |created_on |updated_on |purchased_date|warranty_expire_date|state |properties| | |
| : : +----+-------+-----------+------------------+------------+------------------+--------------------------+--------------------------+--------------+--------------------+------+----------+ | |
| : : | 3| 1| 1| 1|My third car|My third super car|2022-11-17T15:29:40.593690|2022-11-17T15:29:40.593690|2012-05-19 |{null} |STORED|{null} | | |
| : : +----+-------+-----------+------------------+------------+------------------+--------------------------+--------------------------+---- |
This file contains hidden or 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
| logging: | |
| level: | |
| org: | |
| jooq: | |
| tools: | |
| LoggerListener: debug |
This file contains hidden or 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
| var removeIllegalCharacters = function (input) { | |
| console.info(input); | |
| return input | |
| .replace(/=/g, '') | |
| .replace(/\+/g, '-') | |
| .replace(/\//g, '_'); | |
| }; | |
| var base64object = function (input) { | |
| var inputWords = CryptoJS.enc.Utf8.parse(JSON.stringify(input)); |